ERXTimestampUtilities Class Reference

Collaboration diagram for ERXTimestampUtilities:

Collaboration graph
[legend]

List of all members.

Classes

class  ERXTimestamp

Static Public Member Functions

static NSTimestamp dateByAddingTime (NSTimestamp ts, NSTimestamp t1)
static NSTimestamp distantFuture ()
static NSTimestamp distantPast ()
static NSTimestamp epoch ()
static boolean isEarlierThan (NSTimestamp ts1, NSTimestamp ts2)
static boolean isLaterThan (NSTimestamp ts1, NSTimestamp ts2)
static String simpleDateFormatForNSTimestampFormat (String timestampFormatterPattern)
static NSTimestamp timestampByAddingTime (NSTimestamp ts, NSTimestamp t1)
static NSTimestamp timestampForString (String defaultValue)
static NSTimestamp today ()
static NSTimestamp tomorrow ()
static NSTimestamp unixDate (Number helpedNSNumber)
static Integer unixTimestamp (NSTimestamp ts)
static NSTimestamp yesterday ()

Static Package Functions

static ERXTimestamp getInstance (NSTimestamp ts)
static ERXTimestamp getInstance ()

Static Package Attributes

static NSTimestamp _epoch = new NSTimestamp(1970, 1, 1, 0, 0, 0, null)


Detailed Description

Collection of NSTimestamp utilities.

Member Function Documentation

static NSTimestamp dateByAddingTime ( NSTimestamp  ts,
NSTimestamp  t1 
) [static]

Deprecated:
use timestampByAddingTime instead

static NSTimestamp distantFuture (  )  [static]

Cover method for returning DistantFuture off of NSTimestamp.

Deprecated:
use NSTimestamp.DistantFuture instead
Returns:
a date in the distant future

static NSTimestamp distantPast (  )  [static]

Cover method for returning DistantPast off of NSTimestamp.

Deprecated:
use NSTimestamp.DistantPast instead
Returns:
a date in the distant past

static NSTimestamp epoch (  )  [static]

Utility method used to retrun the epoch, Jan 1st, 1970

Returns:
the epoch as an NSTimestamp

static ERXTimestamp getInstance ( NSTimestamp  ts  )  [static, package]

Package level access for returning an instance of the inner class ERXTimestamp for the given time.

Parameters:
ts a timestamp
Returns:
instance of ERXTimestamp for the given time.

static ERXTimestamp getInstance (  )  [static, package]

Package level access for returning an instance of the inner class ERXTimestamp for the current time.

Returns:
instance of ERXTimestamp for the current time.

static boolean isEarlierThan ( NSTimestamp  ts1,
NSTimestamp  ts2 
) [static]

Compares two timestamps.

Deprecated:
use java.sql.Timestamp.before<code> instead.
Parameters:
ts1 first timestamp
ts2 second timestamp
Returns:
true if the the second timestamp is earlier than the first timestamp.

static boolean isLaterThan ( NSTimestamp  ts1,
NSTimestamp  ts2 
) [static]

Compares two timestamps.

Deprecated:
use java.sql.Timestamp.after<code> instead.
Parameters:
ts1 first timestamp
ts2 second timestamp
Returns:
true if the the second timestamp is later than the first timestamp.

static String simpleDateFormatForNSTimestampFormat ( String  timestampFormatterPattern  )  [static]

Returns the SimpleDateFormat pattern given an NSTimestampFormatter pattern. Note that these are not 100% compatible -- SimpleDateFormat properly implements DST and TimeZones whereas NSTimestampFormatter is ... kind of whacked, so you may notice your dates are off by a DST amount.

Parameters:
timestampFormatterPattern the NSTimestampFormatter pattern
Returns:
a SimpleDateFormat pattern

static NSTimestamp timestampByAddingTime ( NSTimestamp  ts,
NSTimestamp  t1 
) [static]

Adds the time (hours, minutes and seconds) from the second timestamp to the first timestamp.

Parameters:
ts timestamp to have the time added too.
t1 timestamp to add the time from
Returns:
the first timestamp with the time of the second added to it.

static NSTimestamp timestampForString ( String  defaultValue  )  [static]

Calculates a timestamp given a string. Currently supports the strings: now, today, yesterday, tomorrow, distantPast and distantFuture.

Parameters:
defaultValue string given above
Returns:
timestamp equivalent to the string

static NSTimestamp today (  )  [static]

Timestamp representing today (12:00 AM). Implementation wise this method subtracts the current hours, minutes and seconds from the current time.

Returns:
timestamp for today.

static NSTimestamp tomorrow (  )  [static]

Timestamp representing tomorrow (12:00 AM). Implementation wise this method subtracts the current hours, minutes and seconds from the current time and then adds one day.

Returns:
timestamp for tomorrow.

static NSTimestamp unixDate ( Number  helpedNSNumber  )  [static]

Converts an offset from the epoch into a timestamp.

Parameters:
helpedNSNumber number offset from the epoch
Returns:
timestamp representation of the offset from the epoch.

static Integer unixTimestamp ( NSTimestamp  ts  )  [static]

Converts a timestamp into the equivalent unix offset from the epoch.

Parameters:
ts timestamp to be converted
Returns:
timestamp represented as an integer offset from the epoch.

static NSTimestamp yesterday (  )  [static]

Timestamp representing yesterday (12:00 AM). Implementation wise this method subtracts the current hours, minutes and seconds from the current time and then subtracts one day.

Returns:
timestamp for yesterday.


Member Data Documentation

NSTimestamp _epoch = new NSTimestamp(1970, 1, 1, 0, 0, 0, null) [static, package]

holds a static reference to the epoch


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:15 2012 for Project Wonder by  doxygen 1.5.8