「Flutter/日時」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→unixtime) |
(→unixtime) |
||
行5: | 行5: | ||
DateTime dd = new DateTime.fromMillisecondsSinceEpoch(unixtime); | DateTime dd = new DateTime.fromMillisecondsSinceEpoch(unixtime); | ||
print("date=$dd"); // date=2019-05-06 04:56:30.237 | print("date=$dd"); // date=2019-05-06 04:56:30.237 | ||
+ | print("date:${dd.toString().substring(0,16)}"); // date=2019-05-06 04:56 | ||
==x日前== | ==x日前== | ||
https://stackoverflow.com/questions/50632217/dart-flutter-converting-timestamp | https://stackoverflow.com/questions/50632217/dart-flutter-converting-timestamp |
2019年5月6日 (月) 05:03時点における版
unixtime
int unixtime = DateTime.now().toUtc().millisecondsSinceEpoch; print("unixtime=$unixtime"); // unixtime=1557085819211
DateTime dd = new DateTime.fromMillisecondsSinceEpoch(unixtime); print("date=$dd"); // date=2019-05-06 04:56:30.237 print("date:${dd.toString().substring(0,16)}"); // date=2019-05-06 04:56
x日前
https://stackoverflow.com/questions/50632217/dart-flutter-converting-timestamp