1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Flutter】 unixtimeから見やすいフォーマットに変換する

Posted at

unixtimeからxxxx年xx月xx日みたいな感じで見やすみ形に変換する処理を残しておきます。

  String convertTime(int t) {
     //int型からDateTime型に変換
    DateTime date = DateTime.fromMicrosecondsSinceEpoch(t);
    String time = DateFormat("yyyy年MM月dd日").format(date).toString();
    return time; //例 2020年08月14日
  }

y(年)、M(月)、d(日)を使えば好きなフォーマットにすることができます。

1
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?