はじめに
すべての環境でこうなのかどうかわからないが、注意したほうがよいこと(知っておいたほうがよいこと)。
年
多くの場合 OK: yyyy
多くの場合 NG: YYYY
参考: http://d.hatena.ne.jp/nakamura001/20150102/1420213850
YYYY
ある年における「最初の木曜日を含む週が、その年の第1週である」というルールで年(西暦)を出力。例えば 2015/1/1 は木曜日なのでその週の日は日曜日~土曜日まで全て2015年の第1週という解釈になり、 2014/12/28(日曜)~2014/12/31(水曜) の時に YYYY を使うと 2015 を返します。
月
MM
が月
。
mm
は分
。
日
多くの場合 OK: dd
多くの場合 NG: DD
DD
は1月1日から何日たったかを示す。
参考: http://www.unicode.org/reports/tr35/tr35-25.html#Date_Format_Patterns
| D | 1..3 | 345 | Day of year |
時
hh
が01
~12
。
HH
が01
~24
。
hh
の方は午前(am)か午後(pm)を示す a
と一緒に用いないと、例えば朝7時なのか夜7時なのか判別不能になる。
分
mm
は分
。
MM
が月
。
秒
多くの場合 OK: ss
多くの場合 NG: SS
参考: http://www.unicode.org/reports/tr35/tr35-25.html#Date_Format_Patterns
S 1..n 3456 Fractional Second - truncates (like other time fields) to the count of letters. (example shows display using pattern SSSS for seconds value 12.34567)