Java - Date

About

A Date is a java object that wraps time information.

  • java/util/Date - The class Date represents a specific instant in time, with millisecond precision. It's an instant on the time-line, not a “date”. (ie not the description of the date, as used for birthdays.) The actual data stored is a long count of milliseconds since 1970-01-01T00:00Z (midnight at the start of 1970 GMT/UTC).
  • java/sql/Date wrapper around java/util/Date that stores the date with milliseconds in epoch format in the timezone zero GMT (ie london)
  • Java - LocalDate (no timezone, no time part with day precision, only YYYY-MM-DD)

Management

Conversion

to Calendar

Date actualDate = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(actualDate);

Powered by ComboStrap