| Modifier and Type | Field and Description |
|---|---|
static TimeZone |
UTC_TIMEZONE |
| Constructor and Description |
|---|
Instants() |
| Modifier and Type | Method and Description |
|---|---|
static long |
convertDate(long time,
TimeZone from,
TimeZone to)
Converts a given time from a
TimeZone to another |
static long |
convertDateToLocalTime(long time,
TimeZone to)
Converts a given time from UTC (Coordinated Universal Time) to the corresponding time in the specified
TimeZone |
static long |
convertDateToUTC(long time,
TimeZone from)
Converts a given time from the specified
TimeZone to the corresponding UTC (Coordinated Universal Time) time |
static Date |
of(int year)
Creates an UTC-based
Date using the provided year. |
static Date |
of(int year,
int month)
|
static Date |
of(int year,
int month,
int day)
Creates an UTC-based
Date from the provided year, month and day
Uses the current date and time, sets the specified year, month and day, and returns the Date converted to a UTC timestamp. |
static Date |
of(int year,
int month,
int day,
int hour)
|
static Date |
of(int year,
int month,
int day,
int hour,
int minute)
|
static Date |
of(int year,
int month,
int day,
int hour,
int minute,
int second)
|
static Date |
of(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond)
|
static String |
toUtcIso8601(Date date)
Returns the UTC-normalized ISO 8601 representation of the specified date instance.
|
public static final TimeZone UTC_TIMEZONE
public static String toUtcIso8601(Date date)
date - the date to format.public static long convertDateToLocalTime(long time,
TimeZone to)
TimeZonepublic static long convertDateToUTC(long time,
TimeZone from)
TimeZone to the corresponding UTC (Coordinated Universal Time) timetime - the instant to convert, represented as the number of milliseconds that have elapsed since midnight, January 1, 1970from - the original TimeZonepublic static long convertDate(long time,
TimeZone from,
TimeZone to)
TimeZone to anothertime - the instant to convert, represented as the number of milliseconds that have elapsed since midnight, January 1, 1970 in the from TimeZonefrom - the original TimeZoneto - the target TimeZone for the conversionto TimeZonepublic static Date of(int year)
Date using the provided year.
Uses the current date and time, sets the specified year and returns the Date converted to a UTC timestamp.year - the year to representDatepublic static Date of(int year, int month)
Date from the provided year and month.
Uses the current date and time, sets the specified year and month, and returns the Date converted to a UTC timestamp.year - the year to representmonth - the month-of-year to represent, from 0 (January) to 11 (December)Datepublic static Date of(int year, int month, int day)
Date from the provided year, month and day
Uses the current date and time, sets the specified year, month and day, and returns the Date converted to a UTC timestamp.year - the year to representmonth - the month-of-year to represent, from 0 (January) to 11 (December)day - the day-of-month to represent, from 1 to 31Datepublic static Date of(int year, int month, int day, int hour)
Date from the provided year, month, day and hour.
Uses the current date and time, sets the specified year, month, day and hour, and returns the Date converted to a UTC timestamp.year - the year to representmonth - the month-of-year to represent, from 0 (January) to 11 (December)day - the day-of-month to represent, from 1 to 31hour - the hour-of-day to represent, from 0 to 23Datepublic static Date of(int year, int month, int day, int hour, int minute)
Date from the provided year, month, day, hour and minute.
Uses the current date and time, sets the specified year, month, day, hour and minute, and returns the Date converted to a UTC timestamp.year - the year to representmonth - the month-of-year to represent, from 0 (January) to 11 (December)day - the day-of-month to represent, from 1 to 31hour - the hour-of-day to represent, from 0 to 23minute - the minute-of-hour to represent, from 0 to 59Datepublic static Date of(int year, int month, int day, int hour, int minute, int second)
Date from the provided year, month, day, hour, minute and second.
Uses the current date and time, sets the specified year, month, day, hour, minute and second, and returns the Date converted to a UTC timestamp.year - the year to representmonth - the month-of-year to represent, from 0 (January) to 11 (December)day - the day-of-month to represent, from 1 to 31hour - the hour-of-day to represent, from 0 to 23minute - the minute-of-hour to represent, from 0 to 59second - the second-of-hour to represent, from 0 to 59Datepublic static Date of(int year, int month, int day, int hour, int minute, int second, int millisecond)
Date from the provided year, month, day, hour, minute and second.
Uses the current date and time, sets the specified year, month, day, hour, minute and second, and returns the Date converted to a UTC timestamp.year - the YEAR to representmonth - the MONTH to represent, from 0 (January) to 11 (December)day - the DAY_OF_MONTH to represent, from 1 to 31hour - the HOUR_OF_DAY to represent, from 0 to 23minute - the MINUTE to represent, from 0 to 59second - the SECOND to represent, from 0 to 59millisecond - the MILLISECOND to represent, from 0 to 59DateCopyright © 2018 Okta. All rights reserved.