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