toDateStr method
转换为时间格式(毫秒)
Implementation
String toDateStr({String? pattern}) {
try {
return DateTimeFormatter.formatDate(
DateTime.fromMillisecondsSinceEpoch(this),
pattern: pattern,
);
} catch (e) {
return 'Invalid timestamp';
}
}