Package mil.nga.crs.common
Class DateTime
- java.lang.Object
-
- mil.nga.crs.common.DateTime
-
public class DateTime extends Object
Date and time- Author:
- osbornb
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)IntegergetDay()Get the dayDoublegetFraction()Get the fractionStringgetFractionText()Get the fraction textIntegergetHour()Get the hourIntegergetMinute()Get the minuteIntegergetMonth()Get the monthIntegergetSecond()Get the secondIntegergetTimeZoneHour()Get the signed local time zone hourIntegergetTimeZoneMinute()Get the local time zone minuteintgetYear()Get the yearbooleanhasDay()Check if has a daybooleanhasFraction()Check if has a fractioninthashCode()booleanhasHour()Check if has a hourbooleanhasMinute()Check if has a minutebooleanhasMonth()Check if has a monthbooleanhasSecond()Check if has a secondbooleanhasTime()If date has a time precisionbooleanhasTimeZoneHour()Has a time zone hourbooleanhasTimeZoneMinute()Has a time zone minutebooleanisOrdinal()Is an ordinal daybooleanisTimeZoneUTC()Is the time zone UTCstatic DateTimeparse(String text)Parse the text into a Date TimevoidsetDay(Integer day)Set the dayvoidsetFraction(Double fraction)Set the fractionvoidsetFraction(String fraction)Set the fractionvoidsetHour(Integer hour)Set the hourvoidsetMinute(Integer minute)Set the minutevoidsetMonth(Integer month)Set the monthvoidsetSecond(Integer second)Set the secondvoidsetTimeZoneHour(Integer timeZoneHour)Set the signed local time zone hourvoidsetTimeZoneMinute(Integer timeZoneMinute)Set the local time zone minutevoidsetTimeZoneUTC()Set the time zone as UTCvoidsetYear(int year)Set the yearStringtoString()static DateTimetryParse(String text)Attempt to parse the text into a Date Time
-
-
-
Field Detail
-
HYPHEN
public static final String HYPHEN
Hyphen- See Also:
- Constant Field Values
-
TIME_DESIGNATOR
public static final String TIME_DESIGNATOR
Time Designator- See Also:
- Constant Field Values
-
COLON
public static final String COLON
Colon- See Also:
- Constant Field Values
-
PERIOD
public static final String PERIOD
Period- See Also:
- Constant Field Values
-
UTC
public static final String UTC
UTC Time Zone Designator- See Also:
- Constant Field Values
-
PLUS_SIGN
public static final String PLUS_SIGN
Plus Sign- See Also:
- Constant Field Values
-
MINUS_SIGN
public static final String MINUS_SIGN
Minus Sign- See Also:
- Constant Field Values
-
-
Method Detail
-
parse
public static DateTime parse(String text)
Parse the text into a Date Time- Parameters:
text- date time text- Returns:
- date time
-
tryParse
public static DateTime tryParse(String text)
Attempt to parse the text into a Date Time- Parameters:
text- potential date time text- Returns:
- date time or null
-
isOrdinal
public boolean isOrdinal()
Is an ordinal day- Returns:
- true if ordinal day
-
hasTime
public boolean hasTime()
If date has a time precision- Returns:
- true if has time
-
getYear
public int getYear()
Get the year- Returns:
- year
-
setYear
public void setYear(int year)
Set the year- Parameters:
year- year
-
getMonth
public Integer getMonth()
Get the month- Returns:
- month
-
hasMonth
public boolean hasMonth()
Check if has a month- Returns:
- true if has month
-
setMonth
public void setMonth(Integer month)
Set the month- Parameters:
month- month
-
getDay
public Integer getDay()
Get the day- Returns:
- day
-
hasDay
public boolean hasDay()
Check if has a day- Returns:
- true if has day
-
setDay
public void setDay(Integer day)
Set the day- Parameters:
day- day
-
getHour
public Integer getHour()
Get the hour- Returns:
- hour
-
hasHour
public boolean hasHour()
Check if has a hour- Returns:
- true if has hour
-
setHour
public void setHour(Integer hour)
Set the hour- Parameters:
hour- hour
-
getMinute
public Integer getMinute()
Get the minute- Returns:
- minute
-
hasMinute
public boolean hasMinute()
Check if has a minute- Returns:
- true if has minute
-
setMinute
public void setMinute(Integer minute)
Set the minute- Parameters:
minute- minute
-
getSecond
public Integer getSecond()
Get the second- Returns:
- second
-
hasSecond
public boolean hasSecond()
Check if has a second- Returns:
- true if has second
-
setSecond
public void setSecond(Integer second)
Set the second- Parameters:
second- second
-
getFraction
public Double getFraction()
Get the fraction- Returns:
- fraction
-
getFractionText
public String getFractionText()
Get the fraction text- Returns:
- fraction text
- Since:
- 1.1.0
-
hasFraction
public boolean hasFraction()
Check if has a fraction- Returns:
- true if has fraction
-
setFraction
public void setFraction(Double fraction)
Set the fraction- Parameters:
fraction- fraction
-
setFraction
public void setFraction(String fraction)
Set the fraction- Parameters:
fraction- fraction- Since:
- 1.1.0
-
getTimeZoneHour
public Integer getTimeZoneHour()
Get the signed local time zone hour- Returns:
- time zone hour (+ or -)
-
hasTimeZoneHour
public boolean hasTimeZoneHour()
Has a time zone hour- Returns:
- true if has time zone hour
-
setTimeZoneHour
public void setTimeZoneHour(Integer timeZoneHour)
Set the signed local time zone hour- Parameters:
timeZoneHour- time zone hour (+ or -)
-
getTimeZoneMinute
public Integer getTimeZoneMinute()
Get the local time zone minute- Returns:
- time zone minute
-
hasTimeZoneMinute
public boolean hasTimeZoneMinute()
Has a time zone minute- Returns:
- true if has time zone minute
-
setTimeZoneMinute
public void setTimeZoneMinute(Integer timeZoneMinute)
Set the local time zone minute- Parameters:
timeZoneMinute- time zone minute
-
isTimeZoneUTC
public boolean isTimeZoneUTC()
Is the time zone UTC- Returns:
- true if UTC
-
setTimeZoneUTC
public void setTimeZoneUTC()
Set the time zone as UTC
-
-