dateFormat method

String? dateFormat(
  1. String pattern, {
  2. bool isSecond = false,
})

根据格式将时间戳(Milliseconds)格式化日期

Implementation

String? dateFormat(String pattern, {bool isSecond = false}) {
  if (this == null) {
    return null;
  }
  num value = this!;
  if (isSecond) {
    value = value * 1000;
  }
  var date = DateTime.fromMillisecondsSinceEpoch(value.toInt());
  return date.dateFormat(pattern);
}