LoginSignup
1
2

More than 5 years have passed since last update.

メモ:android.text.format.DateFormatの挙動

Posted at

概要

android.text.format.DateFormat が具体的にどれが何を出力するのかわからないのでそのメモです。

動作確認用のコード

以下のコードをNexus 5X(7.1.1)で実行した。

Date calendar = new Date();
Log.d("DateFormat", "getLongDateFormat\t" + DateFormat.getLongDateFormat(this).format(calendar));
Log.d("DateFormat", "getMediumDateFormat\t" + DateFormat.getMediumDateFormat(this).format(calendar));
Log.d("DateFormat", "getDateFormat\t" + DateFormat.getDateFormat(this).format(calendar));
Log.d("DateFormat", "getTimeFormat\t" + DateFormat.getTimeFormat(this).format(calendar));

日本語(日本)

Method Result
getLongDateFormat 2017年2月27日
getMediumDateFormat 2017/02/27
getDateFormat 2017/02/27
getTimeFormat 10:27

English(United States)

Method Result
getLongDateFormat February 27, 2017
getMediumDateFormat Feb 27, 2017
getDateFormat 2/27/17
getTimeFormat 10:27 AM
1
2
0

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