0
0

JAVAで現在時刻を文字列にフォーマット(変換)

Posted at

やり方

String now_1_ = DateTimeFormatter.ofPattern("yyyy/MM/dd_HH:mm:ss.SSS").format(LocalDateTime.now());
System.out.println(now_1_);

String now_2_ = DateTimeFormatter.ofPattern("yyyy年MM月dd日(E曜日) HH時mm分ss秒SSS").format(LocalDateTime.now());
System.out.println(now_2_);

参考サイトさん

実行結果

image.png

バージョン

Microsoft Windows [Version 10.0.19045.4170]
JAVA 17.0.8.1

0
0
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
0
0