public final class TimeUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DATE_FORMAT
This is the internal date format used in the database.
|
| Modifier and Type | Method and Description |
|---|---|
static long |
convertTimeToMs(int value,
String units)
Converts a time value to milliseconds in a rather inflexible manner.
|
static long |
convertTimeToMs(String text)
Converts a time value to milliseconds.
|
static String |
createInternalStringDate(Date inputDate)
Creates the internal representation of a date (e.g.
|
static String |
createInternalStringDate(String stringDate,
String dateFormat)
Creates the internal representation of a date (e.g.
|
static DateFormat |
getDateTimeFormatter()
Creates a formatter for generating UTC DateTime strings.
|
static Date |
parseDate(String stringDate,
String dateFormat)
Creates the Date representation of a string date (e.g.
|
public static final String DATE_FORMAT
public static DateFormat getDateTimeFormatter()
DateFormats are not synchronized. It is recommended
to create separate format instances for each thread.public static long convertTimeToMs(int value,
String units)
value - the value to convert.units - a string with one of the values "seconds", "minutes", or "hours".public static long convertTimeToMs(String text)
text - the time value to convert, in the format described above.-1 if the text does not
satisfy the required format.public static String createInternalStringDate(String stringDate, String dateFormat) throws ParseException
stringDate - The string representation of the date (specified in the format dateFormat).dateFormat - The the date format in which the string date is specified.ParseException - - if the sent stringDate cannot be parsed with the given dateFormat.public static Date parseDate(String stringDate, String dateFormat) throws ParseException
stringDate - The string representation of the date (specified in the format dateFormat).dateFormat - The the date format in which the string date is specified.ParseException - - if the sent stringDate cannot be parsed with the given dateFormat.public static String createInternalStringDate(Date inputDate)
inputDate - The date to be formatted into the internal representation.Copyright © 2016 SDL Group. All rights reserved.