ユーチューブ動画
「APIの利用-当月の初日の日付を求める」について解説します。
ソースコード
1 2 3 4 5 6 7 8 9 10 |
import java.time.LocalDate; import java.time.temporal.TemporalAdjusters; public class ExampleDate2 { public static void main(String[] args) { LocalDate current = LocalDate.now(); LocalDate firstDayOfMonth = current.with(TemporalAdjusters.firstDayOfMonth()); System.out.println(firstDayOfMonth); } } |
このサンプルコードをJavaタッチタイプゲームとして遊ぶことができます。