facebook twitter hatena line google mixi email

Flutter/日時

提供: 初心者エンジニアの簡易メモ
移動: 案内検索

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

日付フォーマット変更

https://quickstartflutterdart.blogspot.com/2018/10/how-to-convert-string-to-date-and-date.html