public class TimeUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.text.SimpleDateFormat |
HTTP_DATE_FORMAT |
static long |
MILLIS_IN_DAY |
static int |
SECONDS_IN_DAY |
Constructor and Description |
---|
TimeUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
formatHttpDate(long millis)
Formats time to HTTP date/time format.
|
static java.time.LocalDateTime |
fromCalendar(java.util.Calendar calendar) |
static java.time.LocalDateTime |
fromDate(java.util.Date date) |
static java.time.LocalDateTime |
fromMilliseconds(long milliseconds) |
static long |
parseHttpTime(java.lang.String time)
Parses the HTTP date/time format.
|
static java.util.Calendar |
toCalendar(java.time.LocalDate localDate)
Converts local date time to Calendar and setting time to midnight.
|
static java.util.Calendar |
toCalendar(java.time.LocalDateTime localDateTime)
Converts local date time to Calendar.
|
static java.util.Date |
toDate(java.time.LocalDate localDate)
Converts local date to Date.
|
static java.util.Date |
toDate(java.time.LocalDateTime localDateTime)
Converts local date time to Date.
|
static long |
toMilliseconds(java.time.LocalDate localDate)
Converts local date time to epoh milliseconds assuming start of the day as time point.
|
static long |
toMilliseconds(java.time.LocalDateTime localDateTime)
Converts local date time to epoh milliseconds.
|
public static final int SECONDS_IN_DAY
public static final long MILLIS_IN_DAY
public static final java.text.SimpleDateFormat HTTP_DATE_FORMAT
public static java.util.Date toDate(java.time.LocalDate localDate)
public static java.util.Date toDate(java.time.LocalDateTime localDateTime)
public static java.util.Calendar toCalendar(java.time.LocalDateTime localDateTime)
public static java.util.Calendar toCalendar(java.time.LocalDate localDate)
public static long toMilliseconds(java.time.LocalDateTime localDateTime)
public static long toMilliseconds(java.time.LocalDate localDate)
public static java.time.LocalDateTime fromCalendar(java.util.Calendar calendar)
public static java.time.LocalDateTime fromDate(java.util.Date date)
public static java.time.LocalDateTime fromMilliseconds(long milliseconds)
public static java.lang.String formatHttpDate(long millis)
public static long parseHttpTime(java.lang.String time)
-1
if given string
is invalid.Copyright © 2003-present Jodd Team