|
|||||||||
| Home >> All >> gov >> lanl >> [ Utility overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
gov.lanl.Utility
Class DateTime

java.lang.Objectgov.lanl.Utility.DateTime
- All Implemented Interfaces:
- java.lang.Cloneable
- public class DateTime
- extends java.lang.Object
- implements java.lang.Cloneable
- extends java.lang.Object
Provides a date/time class to support the data in the TeleMed server Date and time are saved together as a double, with the integer part the Julian date, and the fractional part the time in hours (24 hour standard) divided by 24, down to seconds. ALWAYS GMT! Thus every time stamp in the TeleMed data base has date and time.
The julian conversions are modelled after "Numerical Recipes.." by Press, Teukolsky, Vettering, and Flannery; Cambridge University Press
Modified for PIDS time stamp
- Version:
- 12/21/98
| Field Summary | |
private static org.apache.log4j.Logger |
cat
|
(package private) int |
day
The day of the month, 1-31 |
(package private) int |
hour
The hour of the day, 0-23 |
(package private) int |
min
The minutes of the hour, 0-59 |
(package private) int |
month
The month, 1-12 |
(package private) int |
sec
The seconds of the minute, 0-59 |
(package private) int |
year
The year, all digits |
| Constructor Summary | |
DateTime()
Create a DateTime object with the current date time return DateTime initialized to the current date and time |
|
DateTime(java.util.Calendar inCalendar)
Create a DateTime object from a Calendar object |
|
DateTime(int julian)
Create a DateTime object with the requested julian date |
|
DateTime(int yr,
int mo,
int da)
Create a DateTime object with the requested values, 0 for rest |
|
DateTime(int yr,
int mo,
int da,
int hr,
int mn,
int sc)
Create a DateTime object with the requested values |
|
| Method Summary | |
void |
advance(int n)
Deprecated. Replaced by advanceDays |
void |
advanceDays(int n)
Advances this DateTime by n days |
void |
advanceHours(int hr)
Advances this DateTime by hr hours |
void |
advanceMins(int min)
Advances this DateTime by min minutes |
void |
advanceSecs(int sec)
Advances this DateTime by min minutes |
java.lang.Object |
clone()
This method may be called to create a new copy of the Object. |
int |
daysBetween(DateTime other)
positive if this is later than the parameter |
void |
fromJulian(double injulian)
Converts a TeleMed julian (both date & time) to a DateTime The DataTime object exists and its values are changed |
void |
fromPIDTime(long thepidtime)
Converts from PID time to the DateTime class |
int |
getDay()
|
int |
getHour()
|
int |
getMin()
|
int |
getMonth()
|
int |
getSecs()
|
int |
getYear()
|
boolean |
isValid()
|
java.util.Calendar |
makeGMTCalendar()
Creates a calendar object using GMT timezone |
java.util.Calendar |
makeLocalCalendar()
Creates a calendar object using Local timezone |
double |
toJulian()
|
long |
toPIDTime()
Converts the DateTime to PID time |
int |
weekday()
|
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
month
int month
- The month, 1-12
day
int day
- The day of the month, 1-31
year
int year
- The year, all digits
hour
int hour
- The hour of the day, 0-23
min
int min
- The minutes of the hour, 0-59
sec
int sec
- The seconds of the minute, 0-59
cat
private static org.apache.log4j.Logger cat
| Constructor Detail |
DateTime
public DateTime()
- Create a DateTime object with the current date time
return DateTime initialized to the current date and time
DateTime
public DateTime(int yr,
int mo,
int da,
int hr,
int mn,
int sc)
- Create a DateTime object with the requested values
DateTime
public DateTime(int yr,
int mo,
int da)
- Create a DateTime object with the requested values, 0 for rest
DateTime
public DateTime(java.util.Calendar inCalendar)
- Create a DateTime object from a Calendar object
DateTime
public DateTime(int julian)
- Create a DateTime object with the requested julian date
| Method Detail |
advance
public void advance(int n)
- Deprecated. Replaced by advanceDays
- Advances this DateTime by n days
- Advances this DateTime by n days
advanceDays
public void advanceDays(int n)
- Advances this DateTime by n days
advanceHours
public void advanceHours(int hr)
- Advances this DateTime by hr hours
advanceMins
public void advanceMins(int min)
- Advances this DateTime by min minutes
advanceSecs
public void advanceSecs(int sec)
- Advances this DateTime by min minutes
getDay
public int getDay()
getMonth
public int getMonth()
getYear
public int getYear()
getHour
public int getHour()
getMin
public int getMin()
getSecs
public int getSecs()
weekday
public int weekday()
daysBetween
public int daysBetween(DateTime other)
- positive if this is later than the parameter
clone
public java.lang.Object clone()
- Description copied from class:
java.lang.Object - This method may be called to create a new copy of the
Object. The typical behavior is as follows:
o == o.clone()is falseo.getClass() == o.clone().getClass()is trueo.equals(o)is true
However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>
Object.equals(Object)55 .If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.
Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.
All array types implement Cloneable, and override this method as follows (it should never fail):
public Object clone() { try { super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(e.getMessage()); } }
isValid
public boolean isValid()
toJulian
public double toJulian()
fromJulian
public void fromJulian(double injulian)
- Converts a TeleMed julian (both date & time) to a DateTime
The DataTime object exists and its values are changed
fromPIDTime
public void fromPIDTime(long thepidtime)
- Converts from PID time to the DateTime class
toPIDTime
public long toPIDTime()
- Converts the DateTime to PID time
makeGMTCalendar
public java.util.Calendar makeGMTCalendar()
- Creates a calendar object using GMT timezone
makeLocalCalendar
public java.util.Calendar makeLocalCalendar()
- Creates a calendar object using Local timezone
|
|||||||||
| Home >> All >> gov >> lanl >> [ Utility overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
gov.lanl.Utility.DateTime