IMC Epclient 5.0.3

at.spardat.enterprise.util
Class TimeStampUtil

java.lang.Object
  extended byat.spardat.enterprise.util.TimeStampUtil

public class TimeStampUtil
extends java.lang.Object

Utility methods to convert between an internal encoding of a TimeStamp (to be defined below) and java.util.Dates. Note that the maximum precision of java.util.Dates is milliseconds. Although an internal encoding might hold nanoseconds, some information might be lost when converting an internal encoding to a Date.

The string encoding is a decimally encoded number, followed by a blank, followed by a decimally encoded number. The first number is the number of seconds since 19700101 (like a java.util.Date, without millisecond part). The second number denotes the number of nanoseconds. For example, the encoding of the timestamp '2003-02-28 09:53:39.955' is '1046422419 955000000'.


Constructor Summary
TimeStampUtil()
           
 
Method Summary
static java.lang.String date2Internal(java.util.Date d)
          Converts a Date into the internal encoding as defined above.
static java.util.Date internal2Date(java.lang.String internal)
          Converts an internal string to a newly created Date.
static java.lang.String timestamp2Internal(java.sql.Timestamp t)
          Converts a Timestamp into the internal encoding as defined above.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeStampUtil

public TimeStampUtil()
Method Detail

date2Internal

public static java.lang.String date2Internal(java.util.Date d)
Converts a Date into the internal encoding as defined above.

Returns:
non null string following the encoding defined above.

timestamp2Internal

public static java.lang.String timestamp2Internal(java.sql.Timestamp t)
Converts a Timestamp into the internal encoding as defined above.

Parameters:
t -
Returns:
non null string following the encoding defined above.
Since:
version_number

internal2Date

public static java.util.Date internal2Date(java.lang.String internal)
Converts an internal string to a newly created Date.

Parameters:
internal - the encoding as defined above.
Returns:
a date object whose value is equivalent to the provided encoding, except that fractional parts of milliseconds are discarded. null is returned if the provided argument is not a valid encoding.

IMC Epclient 5.0.3