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 5 years have passed since last update.

Caledarクラスを使わない日付取得

Last updated at Posted at 2017-01-27

日付取得と検索して大抵出てくるやつ

Calendar c = Calendar.getInstance();
Date date2 = c.getTime();
/*
そういえばCalendarじゃないけど以下もあるね
Date d = new Date();
*/

Java8で追加されたやつ

//Instantで現在日時を取得
Instant i = Instant.now();
//LocalDateTimeで取得
LocalDateTime l = LocalDateTime.now();

他にも色々あるけど割愛
そういえば、java.sql.Timestamp型からLocalDateTime型に変換できるみたいですね

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?