当前位置:网站首页>flutter 时间戳转日期
flutter 时间戳转日期
2022-08-02 23:19:00 【氤氲息】
///得到留言时间
String getMessageTime() {
String time = '';
int timestamp = downList.createTime! * 1000;
DateTime timeDate = DateTime.fromMillisecondsSinceEpoch(timestamp);
DateTime now = DateTime.now();
if (now.day == timeDate.day) {
time =
"${timeDate.hour.toString().padLeft(2, '0')}:${timeDate.minute.toString().padLeft(2, '0')}:${timeDate.second.toString().padLeft(2, '0')}";
} else {
time =
"${timeDate.month.toString().padLeft(2, '0')}-${timeDate.day.toString().padLeft(2, '0')} ${timeDate.hour.toString().padLeft(2, '0')}:${timeDate.minute.toString().padLeft(2, '0')}:${timeDate.second.toString().padLeft(2, '0')}";
}
return time;
}
ContentCenterText(
getMessageTime(), 10.0, CommonColors.getTextWeakColor())
边栏推荐
猜你喜欢
随机推荐
漫画:怎么证明sleep不释放锁,而wait释放锁?
No-code development platform form styling steps introductory course
Jmeter二次开发实现rsa加密
Technology Sharing | How to do assertion verification for xml format in interface automation testing?
数字化转型巨浪拍岸,成长型企业如何“渡河”?
Find My技术|智能防丢还得看苹果Find My技术
非关系型数据库MongoDB简介和部署
What is the matter that programmers often say "the left hand is knuckled and the right hand is hot"?
js基础知识整理之 —— 全局作用域
十二、form表单的提交
十三、数据回显
js基础知识整理之 —— 字符串
vant-swipe adaptive picture height + picture preview
Swift中的类型相关内容
B站回应HR称用户是Loser:涉事面试官去年底已被劝退
Rasa 3.x 学习系列- Rasa - Issues 4792 socket debug logs clog up debug feed学习笔记
停止使用 Storyboards 和 Interface Builder
R语言自学 1 - 向量
markdown语法
MySQL最大建议行数2000w, 靠谱吗?








