public class TimeUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static javax.xml.datatype.Duration |
calculateDuration(java.util.GregorianCalendar start,
java.util.GregorianCalendar end)
Calculates the Duration between two GregorianCalendar dates.
|
static javax.xml.datatype.Duration |
createDuration(java.lang.String durationString)
Creates the duration.
|
static java.text.SimpleDateFormat |
getISO8601ZuluFormatter()
Returns an instance of SimpleDateFormat that produces formatted
dates using ISO8601 format 2020-12-31T00:00:00Z note Z is GMT time.
|
static int |
getLastMonthDay(int month,
int year)
Returns the maximum day for the month and year passed in as parameter.
|
static java.util.Locale |
getLocaleNoLocale()
Returns Locale.ROOT
|
static java.util.TimeZone |
getNoTimeZoneTimeZone()
Returns the time zone assigned to dates that has no specific time zone.
|
static java.util.GregorianCalendar |
newGregorianCalendar()
Factory for GregorianCalendar instances that can be
used consistently in the XBRL API and are compatible
with the XML API.
|
static java.util.GregorianCalendar |
newGregorianCalendar(java.util.Date date)
Factory method to create a GregorianCalendar instance that has
no time zone and corresponds with the time indicated in the Date
received as a parameter.
|
static java.util.GregorianCalendar |
normalizeTimeZone(java.util.GregorianCalendar calendar)
This method removes time zone information from an instance of a GregorianCalendar and makes it
usable for the XBRL API.
|
static java.util.Date |
parseIso8601Date(java.lang.String dateIso8601)
Parse an ISO8601 date and returns an instance of Date.
|
static java.lang.String |
toTime(long timeMillis)
Display the amount of time indicated in milliseconds as one string
according to locale.
|
public static java.util.GregorianCalendar newGregorianCalendar()
public static java.util.GregorianCalendar newGregorianCalendar(java.util.Date date)
date
- the datepublic static java.util.GregorianCalendar normalizeTimeZone(java.util.GregorianCalendar calendar)
calendar
- input instance of GregorianCalendar the time zone will be removedpublic static java.util.Locale getLocaleNoLocale()
public static java.util.TimeZone getNoTimeZoneTimeZone()
public static javax.xml.datatype.Duration calculateDuration(java.util.GregorianCalendar start, java.util.GregorianCalendar end)
start
- as a GregorianCalendarend
- as a GregorianCalendarpublic static javax.xml.datatype.Duration createDuration(java.lang.String durationString)
durationString
- the duration stringpublic static java.lang.String toTime(long timeMillis)
timeMillis
- the time millispublic static int getLastMonthDay(int month, int year)
The method works as expected for leap years so February has 28 days in a non leap year and 29 days in a leap year.
The value of month parameter is normally a value between 0 and 11 but can be positive or negative integer. The result will be that the actual month and year to calculate the maximum value will be updated as expected. For example: year=1995, month = -2 means November 1994 and the result value will be 30.
month
- the monthyear
- the yearpublic static java.text.SimpleDateFormat getISO8601ZuluFormatter()
public static java.util.Date parseIso8601Date(java.lang.String dateIso8601)
dateIso8601
- string representation in ISO8601 formatjava.lang.RuntimeException
- when the input date is not an ISO8601 dateCopyright 2006-2015 Reporting Standard S.L., C/ Torrecilla del Puerto 1, 28043, Madrid, Espaņa