edu.cmu.aura.service.xml.xmlschema
Class TimeInstant

java.lang.Object
  |
  +--edu.cmu.aura.service.xml.xmlschema.TimeInstant

public class TimeInstant
extends java.lang.Object

TimeInstant is the XML Schema primitive type that represents an instant of time.

Example TimeInstant templates:

	yyyy-mm-ddThh:mm:ssZ
yyyy-mm-ddThh:mm:ss.xxZ
yyyy-mm-ddThh:mm:ss-hh:mm
yyyy-mm-ddThh:mm:ss.xxxx-hh:mm
yyyy-mm-ddThh:mm:ss+hh:mm

By default, this class will use the Java default time zone when creating a new instance given Java time (which is milliseconds since January 1, 1970).


Constructor Summary
TimeInstant(long millis)
          Creates a new TimeInstant from Java time in milliseconds.
TimeInstant(java.lang.String def)
          Creates a new TimeInstant from a serialized definition.
 
Method Summary
 long convertToMillis()
          Get the value of this instant in seconds.
 double convertToSeconds()
          Get the value of this instant in seconds.
 int getDay()
          Gets the day field of this instant.
 int getHour()
          Gets the hour field of this instant.
 int getMinute()
          Gets the minute field of this instant.
 int getMonth()
          Gets the month field of this instant.
 double getSecond()
          Gets the second field of this instant.
 int getYear()
          Gets the year field of this instant.
static void main(java.lang.String[] args)
           
static int parseInt(java.lang.String def)
          Allows a + to precede the regular parse int.
 java.lang.String toString()
          Serialize this TimeInstant in manner that conforms to the XMLSchema TimeInstant definition.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeInstant

public TimeInstant(java.lang.String def)
            throws DataFormatException
Creates a new TimeInstant from a serialized definition.

Parameters:
def - time instant definition

TimeInstant

public TimeInstant(long millis)
Creates a new TimeInstant from Java time in milliseconds. That is, milliseconds since since January 1, 1970 UTC.

Parameters:
millis - time in millis
Method Detail

parseInt

public static int parseInt(java.lang.String def)
Allows a + to precede the regular parse int.


getSecond

public double getSecond()
Gets the second field of this instant.

Returns:
second field of this instant

getMinute

public int getMinute()
Gets the minute field of this instant.

Returns:
minute field of this instant

getHour

public int getHour()
Gets the hour field of this instant.

Returns:
hour field of this instant

getDay

public int getDay()
Gets the day field of this instant.

Returns:
day field of this instant

getMonth

public int getMonth()
Gets the month field of this instant.

Returns:
month field of this instant

getYear

public int getYear()
Gets the year field of this instant.

Returns:
year field of this instant

convertToSeconds

public double convertToSeconds()
Get the value of this instant in seconds. Java time in seconds is returned (seconds since January 1, 1970).

Returns:
length of this instant in seconds according to Java time.

convertToMillis

public long convertToMillis()
Get the value of this instant in seconds. Java time is returned (millseconds since January 1, 1970).

Returns:
length of this instant in milliseconds according to Java time.

toString

public java.lang.String toString()
Serialize this TimeInstant in manner that conforms to the XMLSchema TimeInstant definition.

Overrides:
toString in class java.lang.Object
Returns:
a serialized version of this TimeInstant

main

public static void main(java.lang.String[] args)