format method

String format(
  1. int time, {
  2. String format = 'yy-MM-dd hh:mm:ss',
})

yy-MM-dd hh:mm:ss @param time 秒级

Implementation

String format(int time, {String format = 'yy-MM-dd hh:mm:ss'}) {
  final DateTime date = DateTime.fromMillisecondsSinceEpoch(time * 1000);
  final formatter = DateFormat(format);
  return formatter.format(date);
}