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 boolean
equals(Object obj)
Integer
getDay()
Get the dayDouble
getFraction()
Get the fractionString
getFractionText()
Get the fraction textInteger
getHour()
Get the hourInteger
getMinute()
Get the minuteInteger
getMonth()
Get the monthInteger
getSecond()
Get the secondInteger
getTimeZoneHour()
Get the signed local time zone hourInteger
getTimeZoneMinute()
Get the local time zone minuteint
getYear()
Get the yearboolean
hasDay()
Check if has a dayboolean
hasFraction()
Check if has a fractionint
hashCode()
boolean
hasHour()
Check if has a hourboolean
hasMinute()
Check if has a minuteboolean
hasMonth()
Check if has a monthboolean
hasSecond()
Check if has a secondboolean
hasTime()
If date has a time precisionboolean
hasTimeZoneHour()
Has a time zone hourboolean
hasTimeZoneMinute()
Has a time zone minuteboolean
isOrdinal()
Is an ordinal dayboolean
isTimeZoneUTC()
Is the time zone UTCstatic DateTime
parse(String text)
Parse the text into a Date Timevoid
setDay(Integer day)
Set the dayvoid
setFraction(Double fraction)
Set the fractionvoid
setFraction(String fraction)
Set the fractionvoid
setHour(Integer hour)
Set the hourvoid
setMinute(Integer minute)
Set the minutevoid
setMonth(Integer month)
Set the monthvoid
setSecond(Integer second)
Set the secondvoid
setTimeZoneHour(Integer timeZoneHour)
Set the signed local time zone hourvoid
setTimeZoneMinute(Integer timeZoneMinute)
Set the local time zone minutevoid
setTimeZoneUTC()
Set the time zone as UTCvoid
setYear(int year)
Set the yearString
toString()
static DateTime
tryParse(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
-
-