public class Date extends Object
DateSentence.DateSentence,
Time| Modifier and Type | Field and Description |
|---|---|
static int |
PIVOT_YEAR
A pivot value that is used to determine century for two-digit year
values.
|
| Constructor and Description |
|---|
Date()
Creates a new instance of
Date using the current date. |
Date(int year,
int month,
int day)
Constructor with date values.
|
Date(String date)
Creates a new instance of
Date, assumes the default NMEA
0183 date formatting, ddmmyy or ddmmyyyy. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
int |
getDay()
Get day of month.
|
int |
getMonth()
Get month, valid values are 1-12 where 1 denotes January, 2 denotes
February etc.
|
int |
getYear()
Get year.
|
int |
hashCode() |
void |
setDay(int day)
Set day of month.
|
void |
setMonth(int month)
Get month, valid values are 1-12 where 1 denotes January, 2 denotes
February etc.
|
void |
setYear(int year)
Set year.
|
Date |
toDate()
Converts to
Date, time of day set to 00:00:00.000. |
String |
toISO8601()
Returns the date in ISO 8601 format (
yyyy-mm-dd). |
String |
toISO8601(Time t)
Returns a timestamp in ISO 8601 format
(
yyyy-mm-ddThh:mm:ss+hh:mm). |
String |
toString()
Returns the String representation of
Date. |
public static final int PIVOT_YEAR
public Date()
Date using the current date.public Date(String date)
Date, assumes the default NMEA
0183 date formatting, ddmmyy or ddmmyyyy.public Date(int year,
int month,
int day)
year - Year, two or four digit value [0..99] or [1000..9999]month - Month [1..12]day - Day [1..31]IllegalArgumentException - If any of the parameter is out of
bounds.public int getDay()
public int getMonth()
public int getYear()
PIVOT_YEAR. Values lower than or
equal to pivot are added to 2000, while values greater than pivot are
added to 1900.PIVOT_YEARpublic void setDay(int day)
day - the day to setpublic void setMonth(int month)
month - the month to setIllegalArgumentException - If specified value is out of bounds
[1..12]public void setYear(int year)
PIVOT_YEAR. Values lower than or
equal to pivot are added to 2000, while values greater than pivot are
added to 1900.year - Year to set, two or four digit value.IllegalArgumentException - If specified value is negative or
three-digit value.PIVOT_YEARpublic String toString()
Date. Formats the date
in ddmmyy format used in NMEA 0183 sentences.public String toISO8601()
yyyy-mm-dd).public String toISO8601(Time t)
yyyy-mm-ddThh:mm:ss+hh:mm).t - Time to format with dateCopyright (C) 2010-2017 Java Marine API authors. All Rights Reserved.