formatTimestamp static method

String formatTimestamp({
  1. int? timestamp,
  2. String? pattern,
})

毫秒级时间戳 转 字符串 1317650580814 => yyyy-MM-dd HH:mm:ss

Implementation

static String formatTimestamp({int? timestamp, String? pattern}) {
  if (pattern == null) pattern = full;
  var dateTime = timestamp == null ? DateTime.now() : DateTime.fromMillisecondsSinceEpoch(timestamp);
  return formatDateTime(dateTime: dateTime, pattern: pattern);
}