public class HecTime
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable, java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
static int |
DAY_GRANULARITY |
static int |
DAY_INCREMENT |
static int |
HOUR_GRANULARITY |
static int |
HOUR_INCREMENT |
static int |
MINUTE_GRANULARITY |
static int |
MINUTE_INCREMENT |
static int |
SECOND_GRANULARITY |
static int |
SECOND_INCREMENT |
static int |
UNDEFINED_VALUE |
| Constructor and Description |
|---|
HecTime()
Default constructor: Time is undefined, resolution to nearest minute.
|
HecTime(java.util.Calendar cal)
Sets date / time to a Java Calendar object.
|
HecTime(java.util.Date javaDate,
int minutesTimezoneOffset)
Sets date / time to a Java Date object
|
HecTime(HecTime hecTime)
Copy Constructor
|
HecTime(int timeGranularity)
Time is undefined
|
HecTime(int value,
int timeGranularity) |
HecTime(java.lang.String date) |
HecTime(java.lang.String date,
int timeGranularity) |
HecTime(java.lang.String date,
java.lang.String time) |
HecTime(java.lang.String date,
java.lang.String time,
int timeGranularity) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(HecTime time)
Add an HecTime to this object (adds the times together)
|
void |
add(int time)
Adds a given amount of time to the current time.
|
static int |
addCentury(int intYear)
This takes a two digit year and adds the "correct" century
|
void |
addDays(int days) |
void |
addHours(int hours) |
void |
addMinutes(int minutes) |
void |
addSeconds(int seconds) |
void |
adjustToIntervalOffset(int intervalMinutes,
int offset)
Adjust the time to be at the interval offset (in minutes) provided.
|
void |
cleanTime() |
java.lang.Object |
clone() |
int |
compareTimes(HecTime time)
Compares this time with input time.
|
int |
compareTo(java.lang.Object o)
compareTo
|
int |
computeNumberIntervals(HecTime otherTime,
int intervalInMins)
Get the number of periods between two times (Heclib nopers function)
|
static int |
computeNumberIntervals(int startTimeMins,
int endTimeMins,
int intervalInMins)
Get the number of periods between two times given in minutes (Heclib nopers function)
|
static void |
convertTimeZone(HecTime hecTime,
java.util.TimeZone fromTimeZone,
java.util.TimeZone toTimeZone)
Converts the HecTime from the fromTimeZone to the toTimeZone
Respectes Daylight savings time
|
static void |
convertTimeZone(HecTime hecTime,
java.util.TimeZone fromTimeZone,
java.util.TimeZone toTimeZone,
boolean respectDST)
Converts the HecTime from the fromTimeZone to the toTimeZone
User decides on respecting Daylight savings time
|
static HecTime |
convertToTimeZone(HecTime hecTime,
java.util.TimeZone fromTimeZone,
java.util.TimeZone toTimeZone)
Convience function for convertTimeZone
Returns a COPY of the time, with the original left unchanged
Converts the HecTime from the fromTimeZone to the toTimeZone
Respectes Daylight savings time
|
static HecTime |
convertToTimeZone(int minsSince1900,
java.util.TimeZone fromTimeZone,
java.util.TimeZone toTimeZone)
Convience function for convertTimeZone *
Converts the HecTime from the fromTimeZone to the toTimeZone
Respectes Daylight savings time
|
static void |
curtim(int[] jul,
int[] itime) |
static void |
datcln(int julianIn,
int timeIn,
int[] julianOut,
int[] timeOut)
This method cleans up the date and minutes so that timeOut is never
greater than 1440 minutes.
|
java.lang.String |
date()
Returns a String representation for the data part of HecTime in the format
2 June 1985.
|
java.lang.String |
date(int style)
Retruns a String representation for the date part of HecTime
|
java.lang.String |
dateAndTime()
Returns the date and time represented by this object as a string in the form of
dMMMYYYY, TTTT
|
java.lang.String |
dateAndTime(int style)
Returns a string representation of the date and time in the form of
|
static int |
datjul(java.lang.String charDate,
int[] julian)
Takes a character date, in a variety of styles, and converts it into a
Julian date in days since December 31, 1899.
|
static void |
datjul(java.lang.String charDate,
intContainer julian,
intContainer errorCode)
Takes a character date, in a variety of styles, and converts it into a
Julian date in days since December 31, 1899.
|
static int |
datymd(java.lang.String charDate,
int[] ymd)
Takes a character date, in a variety of styles, and converts it into an
integer year-month-day style date.
|
static void |
datymd(java.lang.String charDate,
intContainer year,
intContainer month,
intContainer day,
intContainer errorCode)
Takes a character date, in a variety of styles, and converts it into an
integer year-month-day style date.
|
int |
day()
returns the day of the month
|
int |
dayOfWeek()
Returns the day of the week as an int.
|
java.lang.String |
dayOfWeekName()
Returns a string containing the name of the day of the week
(e.g., "Sunday", "Monday")
|
int |
dayOfYear()
Returns the julian day of the year, with Jan 1 = 1, Jan 2 = 2
|
boolean |
equalTo(HecTime time)
Determine if two HecTime object contain equal times
|
int |
getDefaultDateStyle() |
static void |
getime(java.lang.String line,
int[] juls,
int[] istime,
int[] jule,
int[] ietime,
int[] status)
Obtains a time window from a program command line input.
|
int |
getIntervalOffset(int intervalMinutes)
Compute the time offset from the provided time interval in minutes,
for standard intervals used in DSS.
|
java.util.Date |
getJavaDate(int minutesTimezoneOffset)
Returns a Java Date object for this date / time
|
long |
getMinutes()
Get Julian date / time in minutes.
|
long |
getMinutes(int minutesTimezoneOffset)
Get Julian date / time in minutes.
|
boolean |
getShowsTimeAsBeginningOfDay()
Get the object setting if midnight is shown as the beginning of the next day
|
java.lang.String |
getTime(boolean withColons)
Get the time portion as user displayable string
withColons == true, hh:mm:ss
withColons == false, hhmm
For example, if withColons, return "08:30:00",
withColons == false, return "0830"
|
int |
getTimeGranularity()
Gets the time resolution
|
int |
getTimeIncrement()
Deprecated.
|
long |
getTimeInMillis()
Get the date / time in milliseconds (same units that Java uses) in UTC.
|
long |
getTimeInMillis(java.util.Calendar cal)
Get the date / time in milliseconds (same units that Java uses)
|
long |
getTimeInMillis(int minutesTimezoneOffset)
Get the date / time in milliseconds (same units that Java uses)
|
static int |
getTimeWindow(java.lang.String userLine,
HecTime startTime,
HecTime endTime)
A general purpose function to take a users time window input line,
and compute a starting time and ending time
For example "20May95 1200 13Jan97 0500" or "t-5d, t"
The start time and end time are adjusted if specified (e.g., "-5D +2H")
Implements Heclib getime routine
|
java.lang.String |
getXMLDateTime(int minutesTimezoneOffset)
Returns a String for this date / time, formatted for use in XML
|
boolean |
greaterThan(HecTime time)
Determine if this object has a time greater than the one passed in
|
boolean |
greaterThanEqualTo(HecTime time)
Determine if this object has a time greater than or equal to the one passed in
|
int |
hour()
returns the hour of the time portion (0 - 24)
|
java.lang.String |
hourMinutes()
Returns a string representation in the form HHMM
|
int |
hoursMinutesSeconds(intContainer hiHours,
intContainer hiMinutes,
intContainer hiSeconds)
Obtains the time portion in int containers as hours, minutes and seconds
|
static int |
idaywk(int jul)
Returns integer day of week.
|
static int |
ihm2m(java.lang.String time)
Takes a character string containing a twenty-four hour military style
clock time (e.g., '1630'), and converts it into minutes past midnight.
|
void |
increment(int numberPeriods,
int minutesInPeriod)
Add a number of time periods to this date / time
|
static void |
inctim(int interval,
int numPeriods,
int startJulian,
int startTime,
int[] endJulian,
int[] endTime)
increments a Julian date and time a specified number of periods, based
on a given time interval.
|
static int |
inctim(int interval,
int unitFlag,
int numPeriods,
int startJulian,
int startTime,
intContainer endJulian,
intContainer endTime)
increments a Julian date and time a specified number of periods, based
on a given time interval.
|
static boolean |
isAlwaysShowTimeAsBeginningOfDay()
deprecated.
|
boolean |
isDateDefined() |
boolean |
isDefined()
Returns if the date / time is defined
|
static boolean |
isLeap(int year)
Checks if a given year is a leap year
|
int |
isoDate()
Generates and retuns an ISO style date as an int: YYMMDD
|
int |
isoTime()
Generate and return an ISO style time as an int: HHMMSS
|
boolean |
isTimeDefined() |
static int |
iymdjl(int intYear,
int intMonth,
int intDay)
Returns the Julian date in days since 31 December 1899 for an integer
date passed in the form of year, month, day
|
static int |
jliymd(int jul,
int[] ymd) |
static int |
jliymd(int jul,
intContainer year,
intContainer month,
intContainer day) |
static java.lang.String |
juldat(int julian,
int style)
Takes a Julian date and a date style code and returns a string of the date
in the style requested.
|
int |
julian()
Returns the HEC julian date
|
boolean |
lessThan(HecTime time)
Determine if this object has a time less than the one passed in
|
boolean |
lessThanEqualTo(HecTime time)
Determine if this object has a time less than or equal to the one passed in
|
static void |
main(java.lang.String[] args) |
int |
minute()
Returns the number of minutes past the hour of the time
|
int |
minutesSinceMidnight()
Returns the number of minutes past midnight for the time portion
|
int |
month()
Returns the month of the date, with Jan = 1, Feb = 2
|
static int |
nopers(int interval,
int startJulian,
int startTime,
int endJulian,
int endTime)
Given two dates and times, and a time interval, the method NOPERS will
determine the number of periods between them.
|
static int |
nopers(int interval,
int unitFlag,
int startJulian,
int startTime,
int endJulian,
int endTime)
Given two dates and times, and a time interval, the method NOPERS will
determine the number of periods between them.
|
boolean |
notEqualTo(HecTime time)
Determine if two HecTime object contain equal times
|
int |
second()
Returns the number of seconds past the last minute of the time
|
int |
secondsSinceMidnight()
Returns the number of seconds since midnight for the time portion
if time is not defined, will return UNDEFINED_VALUE
|
void |
set(java.util.Calendar cal)
Sets date / time to a Java Calendar object.
|
void |
set(java.util.Date javaDate,
int minutesTimezoneOffset)
Sets date / time to a Java Date object
|
void |
set(HecTime hecTime)
Copies a HecTime object
|
void |
set(int value)
Set the date / time to this value (in increments)
For default granularity, this is in minutes.
|
int |
set(java.lang.String dateAndTime)
Sets a string containing both the date and time
|
int |
set(java.lang.String date,
java.lang.String time)
Set the date and time
|
static void |
setAlwaysShowTimeAsBeginningOfDay(boolean alwaysShowBeginningOfDay)
deprecated.
|
void |
setCurrent()
Sets the object to the current system time.
|
int |
setDate(java.lang.String date)
Sets the date portion to the date string passed in
|
void |
setDefaultDateStyle(int defaultDateStyle)
Sets the default String representation for the date part of HecTime
|
void |
setJulian(int julian)
Sets the date to the Hec julian date
|
void |
setJulian(int julian,
int minutesSinceMidnight)
Sets the date to the Hec julian date and minutes past midnight
|
void |
setJulian(int julian,
int minutesSinceMidnight,
int secondsSinceMinute)
Sets the date to the Hec julian date and minutes and seconds past midnight.
|
void |
setMinutes(long minutes)
Set the time in minutes since 31 Dec 1899
|
void |
setMinutes(long minutes,
int minutesTimezoneOffset)
Set the time in minutes since 31 Dec 1899
|
void |
setSeconds(long value) |
int |
setTime(java.lang.String time)
Sets the time portion to the time string passed in (e.g., "1300")
|
void |
setTimeGranularity(int baseGranularity)
Sets or changes the time resolution
|
void |
setTimeIncrement(int baseGranularity)
Deprecated.
Replaced by
setTimeGranularity(int) |
void |
setTimeInMillis(long milliseconds)
Set the time in milliseconds (same units used by Java)
|
void |
setTimeInMillis(long milliseconds,
int minutesTimezoneOffset)
set the time in milliseconds (same units used by Java), along with a time zone offset
|
void |
setUndefined()
Set the date / time to undefined
|
int |
setXML(java.lang.String dateTime)
Sets a string containing both the date and time in XML dateTime
(ISO 8601) format.
|
void |
setYearMonthDay(int year,
int month,
int day)
Sets the date to the year, month, day value and minutes past midnight
Time is not changed (if not defined, left undefined)
|
void |
setYearMonthDay(int year,
int month,
int day,
int minutesSinceMidnight)
Sets the date to the year, month, day value and minutes past midnight
|
void |
showTimeAsBeginningOfDay(boolean showBeginning)
Show midnight at the
beginning of the next day, instead of the end of the previous day.
|
void |
subtract(HecTime time)
Subtract an HecTime from this date / time
|
void |
subtract(int time)
Subtracts a given amount of time to the current time.
|
void |
subtractDays(int days) |
void |
subtractHours(int hours) |
void |
subtractMinutes(int minutes) |
void |
subtractSeconds(int seconds) |
static void |
systim(int[] julian,
int[] seconds)
This method returns a julian date and the number of seconds since midnight
|
java.lang.String |
time()
Get the time portion as user displayable string
(For example, "08:30:00")
|
int |
timeGranularity() |
int |
timeIncrement()
Deprecated.
|
java.lang.String |
toString()
Returns the date and time in a user format
(e.g., "10 June 2002, 13:03:42")
|
java.lang.String |
toString(int dateStyle)
Returns the date and time in the format specified
|
int |
value()
Computes and retuns an int representation of the date/time
Opposite of set(int).
|
int |
year()
Returns the 4 digit year of the date (e.g., 2002)
|
int |
yearMonthDay(intContainer hiYear,
intContainer hiMonth,
intContainer hiDay)
Returns the date portion in int containers as years, months, days
|
static java.lang.String |
ymddat(int[] ymd,
int style,
int[] err)
Takes a date and a date style code and returns a string of the date in the
style requested.
|
static void |
zofset(int[] julian,
int[] iTime,
int interval,
int iFlag,
int[] iOffset)
Determine the time offset for regular interval time series data
|
public static final int SECOND_INCREMENT
public static final int MINUTE_INCREMENT
public static final int HOUR_INCREMENT
public static final int DAY_INCREMENT
public static final int SECOND_GRANULARITY
public static final int MINUTE_GRANULARITY
public static final int HOUR_GRANULARITY
public static final int DAY_GRANULARITY
public static final int UNDEFINED_VALUE
public HecTime()
public HecTime(int timeGranularity)
timeIncrement - defines either how HecTime behaves when
added or the resolution of the time to the nearest:
| Second: | HecTime.SECOND_INCREMENT | |
| Minute: | HecTime.MINUTE_INCREMENT | |
| Hour: | HecTime.HOUR_INCREMENT | |
| Day: | HecTime.DAY_INCREMENT | |
| Second: | HecTime.SECOND_GRANULARITY | |
| Minute: | HecTime.MINUTE_GRANULARITY | |
| Hour: | HecTime.HOUR_GRANULARITY | |
| Day: | HecTime.DAY_GRANULARITY |
public HecTime(int value,
int timeGranularity)
value - (increments) since start of base - default minutes.
For minutes, hours, or days, this is increments since 0000 on Dec 31 1899
(Jan 01, 1900 is defined as day 1).
For seconds, this is seconds since 19Jan1970 at 0000 (same as Unix base time).timeIncrement - defines either how HecTime behaves when
added or the resolution of the time to the nearest:
| Second: | HecTime.SECOND_INCREMENT | |
| Minute: | HecTime.MINUTE_INCREMENT | |
| Hour: | HecTime.HOUR_INCREMENT | |
| Day: | HecTime.DAY_INCREMENT | |
| Second: | HecTime.SECOND_GRANULARITY | |
| Minute: | HecTime.MINUTE_GRANULARITY | |
| Hour: | HecTime.HOUR_GRANULARITY | |
| Day: | HecTime.DAY_GRANULARITY |
public HecTime(java.lang.String date,
java.lang.String time)
date - date string in a variety of formatstime - time string in hours:minutes:seconds (colons not necessary).
If resolution is not to nearest second, seconds are ignored (and not needed).public HecTime(java.lang.String date,
java.lang.String time,
int timeGranularity)
date - date string in a variety of formats.time - time string in hours:minutes:seconds (colons not necessary).
If resolution is not to nearest second, seconds are ignored (and not needed).timeIncrement - defines either how HecTime behaves when
added or the resolution of the time to the nearest:
| Second: | HecTime.SECOND_INCREMENT | |
| Minute: | HecTime.MINUTE_INCREMENT | |
| Hour: | HecTime.HOUR_INCREMENT | |
| Day: | HecTime.DAY_INCREMENT | |
| Second: | HecTime.SECOND_GRANULARITY | |
| Minute: | HecTime.MINUTE_GRANULARITY | |
| Hour: | HecTime.HOUR_GRANULARITY | |
| Day: | HecTime.DAY_GRANULARITY |
public HecTime(java.lang.String date)
date - date string in a variety of formats.public HecTime(java.lang.String date,
int timeGranularity)
date - date string in a variety of formats.timeIncrement - defines either how HecTime behaves when
added or the resolution of the time to the nearest:
| Second: | HecTime.SECOND_INCREMENT | |
| Minute: | HecTime.MINUTE_INCREMENT | |
| Hour: | HecTime.HOUR_INCREMENT | |
| Day: | HecTime.DAY_INCREMENT | |
| Second: | HecTime.SECOND_GRANULARITY | |
| Minute: | HecTime.MINUTE_GRANULARITY | |
| Hour: | HecTime.HOUR_GRANULARITY | |
| Day: | HecTime.DAY_GRANULARITY |
public HecTime(java.util.Date javaDate,
int minutesTimezoneOffset)
javaDate - Java Date objectminutesTimezoneOffset - time zone offset in minutes for this datepublic HecTime(java.util.Calendar cal)
cal - Java Calendar objectpublic HecTime(HecTime hecTime)
hecTime - public static void setAlwaysShowTimeAsBeginningOfDay(boolean alwaysShowBeginningOfDay)
public static boolean isAlwaysShowTimeAsBeginningOfDay()
public void setTimeGranularity(int baseGranularity)
timeIncrement - defines either how HecTime behaves when
added or the resolution of the time to the nearest:
| Second: | HecTime.SECOND_INCREMENT | |
| Minute: | HecTime.MINUTE_INCREMENT | |
| Hour: | HecTime.HOUR_INCREMENT | |
| Day: | HecTime.DAY_INCREMENT | |
| Second: | HecTime.SECOND_GRANULARITY | |
| Minute: | HecTime.MINUTE_GRANULARITY | |
| Hour: | HecTime.HOUR_GRANULARITY | |
| Day: | HecTime.DAY_GRANULARITY |
@Deprecated public void setTimeIncrement(int baseGranularity)
setTimeGranularity(int)timeIncrement - defines either how HecTime behaves when
added or the resolution of the time to the nearest:
| Second: | HecTime.SECOND_INCREMENT | |
| Minute: | HecTime.MINUTE_INCREMENT | |
| Hour: | HecTime.HOUR_INCREMENT | |
| Day: | HecTime.DAY_INCREMENT | |
| Second: | HecTime.SECOND_GRANULARITY | |
| Minute: | HecTime.MINUTE_GRANULARITY | |
| Hour: | HecTime.HOUR_GRANULARITY | |
| Day: | HecTime.DAY_GRANULARITY |
public int getTimeGranularity()
| Second: | HecTime.SECOND_INCREMENT | |
| Minute: | HecTime.MINUTE_INCREMENT | |
| Hour: | HecTime.HOUR_INCREMENT | |
| Day: | HecTime.DAY_INCREMENT | |
| Second: | HecTime.SECOND_GRANULARITY | |
| Minute: | HecTime.MINUTE_GRANULARITY | |
| Hour: | HecTime.HOUR_GRANULARITY | |
| Day: | HecTime.DAY_GRANULARITY |
@Deprecated public int getTimeIncrement()
| Second: | HecTime.SECOND_INCREMENT | |
| Minute: | HecTime.MINUTE_INCREMENT | |
| Hour: | HecTime.HOUR_INCREMENT | |
| Day: | HecTime.DAY_INCREMENT | |
| Second: | HecTime.SECOND_GRANULARITY | |
| Minute: | HecTime.MINUTE_GRANULARITY | |
| Hour: | HecTime.HOUR_GRANULARITY | |
| Day: | HecTime.DAY_GRANULARITY |
public void set(int value)
time - increments since base (e.g., minutes since 31Dec1899).public void setSeconds(long value)
public int set(java.lang.String date,
java.lang.String time)
date - date string in a variety of formats.time - time string in hours:minutes:seconds (colons not necessary).
If resolution is not to nearest second, seconds are ignored (and not needed).public int set(java.lang.String dateAndTime)
dateAndTime - date followed by time, in a variety of formats
(e.g., "20Jan2002 1300").public void set(java.util.Date javaDate,
int minutesTimezoneOffset)
javaDate - Java Date objectminutesTimezoneOffset - time zone offset in minutes for this datepublic void set(java.util.Calendar cal)
cal - Java Calendar objectpublic void set(HecTime hecTime)
hecTime - public int setXML(java.lang.String dateTime)
dateTime - The date and time in XML dateTime (ISO 8601) format.
This format is [-]CCYY-MM-DDThh:mm:ss[{Z|{+|-}rr:nn}]public int setDate(java.lang.String date)
date - date string in a variety of formats.public int setTime(java.lang.String time)
time - time string in hours:minutes:seconds (colons not necessary).
If resolution is not to nearest second, seconds are ignored (and not needed).public void setCurrent()
public void setJulian(int julian)
julian - days since 31Dec1899public void setYearMonthDay(int year,
int month,
int day,
int minutesSinceMidnight)
year - (e.g., 2004)month - (1-12)day - (1-31)minutesAfterMidnight - number of minutes (not time format)
(e.g., noon is 720, not "1200")public void setYearMonthDay(int year,
int month,
int day)
year - (e.g., 2004)month - (1-12)day - (1-31)public void setJulian(int julian,
int minutesSinceMidnight)
julian - days since 31Dec1899minutesSinceMidnight - number of minutes (not time format)
(e.g., noon is 720, not "1200")public void setJulian(int julian,
int minutesSinceMidnight,
int secondsSinceMinute)
julian - days since 31Dec1899minutesSinceMidnight - number of minutes (not time format)
(e.g., noon is 720, not "1200")secondsSinceMinute - seconds after minutepublic void setTimeInMillis(long milliseconds)
milliseconds - Milliseconds since Jan 19, 1970public void setTimeInMillis(long milliseconds,
int minutesTimezoneOffset)
milliseconds - Milliseconds since Jan 19, 1970minutesTimezoneOffset - Minute offset of the time zonepublic void setUndefined()
public boolean isDefined()
public boolean isDateDefined()
public boolean isTimeDefined()
public void showTimeAsBeginningOfDay(boolean showBeginning)
showBeginning - true to show midnight as 00:00 hrs,
false to show midnight as 24:00 hrs (default).public boolean getShowsTimeAsBeginningOfDay()
public java.lang.String date()
date(2)public java.lang.String date(int style)
the - format of the string. The possible values are as follows| 0: June 2, 1985 | 10: June 2, 85 | 100: JUNE 2, 1985 | 110: JUNE 2, 85 |
| 1: Jun 2, 1985 | 11: Jun 2, 85 | 101: JUN 2, 1985 | 111: JUN 2, 85 |
| 2: 2 June 1985 | 12: 2 June 85 | 102: 2 JUNE 1985 | 112: 2 JUN 85 |
| 3: June 1985 | 13: June 85 | 103: JUNE 1985 | 113: JUNE 85 |
| 4: 02Jun1985 | 14: 02Jun85 | 104: 02JUN1985 | 114: 02JUN85 |
| 5: 2Jun1985 | 15: 2Jun85 | 105: 2JUN1985 | 115: 02JUN85 |
| 6: Jun1985 | 16: Jun85 | 106: JUN1985 | 116: JUN85 |
| 7: 02 Jun 1985 | 17: 02 Jun 85 | 107: 02 JUN 1985 | 117: 02 JUN 85 |
| 8: 2 Jun 1985 | 18: 2 Jun 85 | 108: 2 JUN 1985 | 118: 2 JUN 85 |
| 9: Jun 1985 | 19: Jun 85 | 109: JUN 1985 | 119: JUN 85 |
| Numeric Date Styles: | |||
| -1: 6/2/85 | -101: 6/2/1985 | ||
| -2: 6-2-85 | -102: 6-2-1985 | ||
| -11: 06/02/85 | -111: 06/02/1985 | /tr>||
| -12: 06-02-85 | -112: 06-02-1985 | ||
| -13: 1985-06-02 |
public java.util.Date getJavaDate(int minutesTimezoneOffset)
minutesTimezoneOffset - minutes in the time zone offsetpublic java.lang.String getXMLDateTime(int minutesTimezoneOffset)
minutesTimezoneOffset - Timezone offset in minutes.
The date and time of 5 March, 2003 21:45:12 GMT would be returned as
2003-03-05T21:45:12Z if minutesTimeszoneOffset is specified as 0, and as
2003-03-05T13:45:12-08:00 if minuntesTimeOffset is specified as -480.public long getTimeInMillis()
public long getTimeInMillis(int minutesTimezoneOffset)
minutesTimezoneOffset - this is the number of minutes that is subtracted from
the internal date to convert to UTC time.public long getTimeInMillis(java.util.Calendar cal)
cal - this Calendar (and its associated TimeZone) is used to
process the year, month, day, hour, minute, and second of the
HecTime objectpublic long getMinutes()
public long getMinutes(int minutesTimezoneOffset)
minutesTimezoneOffset - this is the number of minutes that is subtracted from
the internal date to convert to UTC time.public void setMinutes(long minutes)
minutes - Minutes since 31 Dec 1899public void setMinutes(long minutes,
int minutesTimezoneOffset)
minutes - Minutes since 31 Dec 1899minutesTimezoneOffset - Minute offset of the time zonepublic java.lang.String getTime(boolean withColons)
public java.lang.String time()
public java.lang.String dateAndTime()
public java.lang.String dateAndTime(int style)
date(int style)public java.lang.String hourMinutes()
public int julian()
public int secondsSinceMidnight()
public int minutesSinceMidnight()
public int hoursMinutesSeconds(intContainer hiHours, intContainer hiMinutes, intContainer hiSeconds)
hiHours - returns the number of hours past midnighthiMinutes - returns the number of minutes past midnighthiSeconds - returns the number of seconds past midnightpublic int yearMonthDay(intContainer hiYear, intContainer hiMonth, intContainer hiDay)
hiYear - returns the 4 digit year (e.g., 2001)hiMonth - returns the month (Jan = 1)hiDay - returns the day of the monthpublic int isoDate()
public int isoTime()
public int year()
public int month()
public int day()
public int hour()
public int minute()
public int second()
public int dayOfYear()
public int dayOfWeek()
public java.lang.String dayOfWeekName()
public void setDefaultDateStyle(int defaultDateStyle)
the - format of the string. The possible values are as follows| 0: June 2, 1985 | 10: June 2, 85 | 100: JUNE 2, 1985 | 110: JUNE 2, 85 |
| 1: Jun 2, 1985 | 11: Jun 2, 85 | 101: JUN 2, 1985 | 111: JUN 2, 85 |
| 2: 2 June 1985 | 12: 2 June 85 | 102: 2 JUNE 1985 | 112: 2 JUN 85 |
| 3: June 1985 | 13: June 85 | 103: JUNE 1985 | 113: JUNE 85 |
| 4: 02Jun1985 | 14: 02Jun85 | 104: 02JUN1985 | 114: 02JUN85 |
| 5: 2Jun1985 | 15: 2Jun85 | 105: 2JUN1985 | 115: 02JUN85 |
| 6: Jun1985 | 16: Jun85 | 106: JUN1985 | 116: JUN85 |
| 7: 02 Jun 1985 | 17: 02 Jun 85 | 107: 02 JUN 1985 | 117: 02 JUN 85 |
| 8: 2 Jun 1985 | 18: 2 Jun 85 | 108: 2 JUN 1985 | 118: 2 JUN 85 |
| 9: Jun 1985 | 19: Jun 85 | 109: JUN 1985 | 119: JUN 85 |
| Numeric Date Styles: | |||
| -1: 6/2/85 | -101: 6/2/1985 | ||
| -2: 6-2-85 | -102: 6-2-1985 | ||
| -11: 06/02/85 | -111: 06/02/1985 | /tr>||
| -12: 06-02-85 | -112: 06-02-1985 | ||
| -13: 1985-06-02 |
public int getDefaultDateStyle()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(int dateStyle)
dateStyle - | 0: June 2, 1985 | 10: June 2, 85 | 100: JUNE 2, 1985 | 110: JUNE 2, 85 |
| 1: Jun 2, 1985 | 11: Jun 2, 85 | 101: JUN 2, 1985 | 111: JUN 2, 85 |
| 2: 2 June 1985 | 12: 2 June 85 | 102: 2 JUNE 1985 | 112: 2 JUN 85 |
| 3: June 1985 | 13: June 85 | 103: JUNE 1985 | 113: JUNE 85 |
| 4: 02Jun1985 | 14: 02Jun85 | 104: 02JUN1985 | 114: 02JUN85 |
| 5: 2Jun1985 | 15: 2Jun85 | 105: 2JUN1985 | 115: 02JUN85 |
| 6: Jun1985 | 16: Jun85 | 106: JUN1985 | 116: JUN85 |
| 7: 02 Jun 1985 | 17: 02 Jun 85 | 107: 02 JUN 1985 | 117: 02 JUN 85 |
| 8: 2 Jun 1985 | 18: 2 Jun 85 | 108: 2 JUN 1985 | 118: 2 JUN 85 |
| 9: Jun 1985 | 19: Jun 85 | 109: JUN 1985 | 119: JUN 85 |
@Deprecated public int timeIncrement()
public int timeGranularity()
public int value()
public static void convertTimeZone(HecTime hecTime, java.util.TimeZone fromTimeZone, java.util.TimeZone toTimeZone)
hecTime - HecTimefromTimeZone - TimeZonetoTimeZone - TimeZonepublic static void convertTimeZone(HecTime hecTime, java.util.TimeZone fromTimeZone, java.util.TimeZone toTimeZone, boolean respectDST)
hecTime - HecTimefromTimeZone - TimeZonetoTimeZone - TimeZonepublic static HecTime convertToTimeZone(int minsSince1900, java.util.TimeZone fromTimeZone, java.util.TimeZone toTimeZone)
hecTime - HecTimefromTimeZone - TimeZonetoTimeZone - TimeZonepublic static HecTime convertToTimeZone(HecTime hecTime, java.util.TimeZone fromTimeZone, java.util.TimeZone toTimeZone)
hecTime - HecTimefromTimeZone - TimeZonetoTimeZone - TimeZonepublic void add(int time)
setTimeIncrement(int)public void addSeconds(int seconds)
public void addMinutes(int minutes)
public void addHours(int hours)
public void addDays(int days)
public void add(HecTime time)
time - public void subtract(HecTime time)
time - HecTime to subtractpublic boolean equalTo(HecTime time)
time - HecTime to compare topublic boolean notEqualTo(HecTime time)
time - HecTime to compare topublic boolean greaterThan(HecTime time)
time - HecTime to compare topublic boolean greaterThanEqualTo(HecTime time)
time - HecTime to compare topublic boolean lessThan(HecTime time)
time - HecTime to compare topublic boolean lessThanEqualTo(HecTime time)
time - HecTime to compare topublic int compareTimes(HecTime time)
time - public void increment(int numberPeriods,
int minutesInPeriod)
numberPeriods - number of periods to increment byminutesInPeriod - number of minutes in each periodpublic int computeNumberIntervals(HecTime otherTime, int intervalInMins)
otherTime - other HecTime to compute betweenintervalInMins - number of minutes in each periodpublic static int computeNumberIntervals(int startTimeMins,
int endTimeMins,
int intervalInMins)
startTimeMins - First time in minutesendTimeMins - time to compute number betweenintervalInMins - number of minutes in each periodpublic void subtract(int time)
setTimeIncrement(int)public void subtractSeconds(int seconds)
public void subtractMinutes(int minutes)
public void subtractHours(int hours)
public void subtractDays(int days)
public void cleanTime()
public int getIntervalOffset(int intervalMinutes)
public void adjustToIntervalOffset(int intervalMinutes,
int offset)
public static int getTimeWindow(java.lang.String userLine,
HecTime startTime,
HecTime endTime)
userLine - input user linestartTime - returns (adjusted) start time of the time windowendTime - returns end timepublic static void getime(java.lang.String line,
int[] juls,
int[] istime,
int[] jule,
int[] ietime,
int[] status)
line - (input) The program command line containing the users time
window input.juls - (input/output) The starting Julian date of the time window,
in days since December 31, 1899. This is changed
(or not changed) according to the input on CLINE.
If the time window is cleared, JULS is set to -777777.istime - (input/output) The starting time of the time window, in minutes
past midnight (for midnight ISTIME is 1440, not zero).
If the time window is cleared, ISTIME is set to -1.jule - (input/output) The ending Julian date of the time window, in days
since December 31, 1899. If the time window is cleared,
JULE is set to -777777.ietime - (input/output) The ending time of the time window, in minutes
past midnight. If the time window is cleared, IETIME is
set to -1.status - (output) A status parameter. If status is returned as zero, the
time window was set without error. If status is returned
as one, the time window was cleared. If status is returned
as negative one, some error occurred and the time window
was cleared.public static int idaywk(int jul)
jul - (input) julian day where Jan 1, 1900 is day 1public static int jliymd(int jul,
intContainer year,
intContainer month,
intContainer day)
public static int jliymd(int jul,
int[] ymd)
public static int iymdjl(int intYear,
int intMonth,
int intDay)
intYear - (input) The year portion of the date. This can either be a
two digit or four digit number. For years prior to 1900, a
four digit number isrequired.intMonth - (input) The integer month portion of the date (e.g., 1
corresponds to January, 2 to February, etc). This must be a
number between 1 and 12.intDay - (input) The integer day of the date. This must be a number
between 1 and 31.public static int addCentury(int intYear)
A two digit year means it is the year that falls within the range of 90 years back (from now) through 10 year forward.
intYear - (input) Two digit year that is to be converted to a four
digit yearpublic static boolean isLeap(int year)
int - year (Year to test)public static int datjul(java.lang.String charDate,
int[] julian)
charDate - (input) A character string containing the date to be converted.julian - (output) The Julian date of charDate, in days since December 31,
1899.public static void datjul(java.lang.String charDate,
intContainer julian,
intContainer errorCode)
charDate - (input) A character string containing the date to be converted.julian - (output) The Julian date of charDate, in days since December 31,
1899.errorCode - (output) A status parameter. Zero indicates the date was
converted. -1 indicates an invalid charDate and julian will be
returned as -777777.public static java.lang.String juldat(int julian,
int style)
julian - (input) The Julian datestyle - (input) The date style codepublic static java.lang.String ymddat(int[] ymd,
int style,
int[] err)
ymd - (input) The date in the form of year, month, and daystyle - (input) The date style codeerr - (output) A status code indicating success (0) or failure (-1)public static void datymd(java.lang.String charDate,
intContainer year,
intContainer month,
intContainer day,
intContainer errorCode)
charDate - (Input) A character string containing the date to be
converted. If no year is provided, the current year is
returned. If no day is provided, the first of the month is
returned (a month must be given).Year - (Output) The year of the date. This will be a four digit year
(e.g., 1982 instead of 82). If no year is given, the current
year will be returned.Month - (Output) The month number of the date provided (January is 1,
February is 2, etc.).Day - (Output) The day of the date. If no day is given, the first
of the month is returned.errorCode - (Output) A status parameter indicating the successfulness of
the conversion. Zero is returned if the date was converted. -1
is returned if an invalid date was given.public static int datymd(java.lang.String charDate,
int[] ymd)
charDate - (Input) A character string containing the date to be
converted. If no year is provided, the current year is
returned. If no day is provided, the first of the month is
returned (a month must be given).ymd - (Output) ymd[0] is the year of the date. This will be a four digit year
(e.g., 1982 instead of 82). If no year is given, the current
year will be returned.
ymd[1] is the month number of the date provided (January is 1,
February is 2, etc.).
ymd[2] is the day of the date. If no day is given, the first
of the month is returned.public static int ihm2m(java.lang.String time)
time - (Input) A character string containing the twenty-four hour
clock time (e.g., '1422')public static int inctim(int interval,
int unitFlag,
int numPeriods,
int startJulian,
int startTime,
intContainer endJulian,
intContainer endTime)
interval - (input) The time interval in either minutes or days
corresponding to the number of periods to increment the date
and time by.unitFlag - (input) Indicates the units of interval. unitFlag = 0
indicates interval is in minutes, unitFlag = 1 indicates
interval is in days.numPeriods - (input) The number of periods to increment the date and time
by. May be a negative number to decrement the date and time.startJulian - (input) The starting Julian date, in days since December 31,
1899.startTime - (input) The starting time, in minutes past midnight.endJulian - (output) The incremented Julian date, in days since December
31, 1899.endTime - (output) The incremented time, in minutes past midnight.public static void inctim(int interval,
int numPeriods,
int startJulian,
int startTime,
int[] endJulian,
int[] endTime)
interval - (input) The time interval in minutes corresponding to the
number of periods to increment the date and time by.numPeriods - (input) The number of periods to increment the date and time
by. May be a negative number to decrement the date and time.startJulian - (input) The starting Julian date, in days since December 31,
1899.startTime - (input) The starting time, in minutes past midnight.endJulian - (output) The incremented Julian date, in days since December
31, 1899.endTime - (output) The incremented time, in minutes past midnight.public static void datcln(int julianIn,
int timeIn,
int[] julianOut,
int[] timeOut)
julianIn - (input) Julian date inputtimeIn - (input) Minutues accompanying julianInjulianOut - (output) revised julian datetimeOut - (output) revised minutes accompanying julianOutpublic static void zofset(int[] julian,
int[] iTime,
int interval,
int iFlag,
int[] iOffset)
julian - (input/output) The date, in hec julian daysiTime - (input/output) The time, in minutes past midnightinterval - (input) The time interval, in minutesiFlag - (input)
0 - Only compute offset
1 - Compute offset, and adjust julian and iTime to the standard time
2 - Adjust julian and iTime according to iOffset (after adjusting to standard, first)iOffset - (input/output) Offset in minutespublic static int nopers(int interval,
int startJulian,
int startTime,
int endJulian,
int endTime)
interval - The time interval corresponding to the number of periods to
determine.startJulian - The julian date of the start of the time window, in days since
December 31, 1899.startTime - The starting time, in minutes past midnight.endJulian - The julian date of the end of the time window, in days since
December 31, 1899.endTime - The ending time, in minutes past midnight.public static int nopers(int interval,
int unitFlag,
int startJulian,
int startTime,
int endJulian,
int endTime)
interval - The time interval corresponding to the number of periods to
determine.unitFlag - Indicates the units of interval. If interval is given in
minutes (the typical case), set unitFlag to 0. If interval is
given in days, set unitFlag to 1.startJulian - The julian date of the start of the time window, in days since
December 31, 1899.startTime - The starting time, in minutes past midnight.endJulian - The julian date of the end of the time window, in days since
December 31, 1899.endTime - The ending time, in minutes past midnight.public static void systim(int[] julian,
int[] seconds)
julian - (Output) HEC Julian Dateseconds - (Output) Number of seconds since midnightpublic static void curtim(int[] jul,
int[] itime)
jul - itime - public int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparableo - Objectpublic java.lang.Object clone()
clone in class java.lang.Objectpublic static void main(java.lang.String[] args)