SYNOPSIS

  use RT::Date

DESCRIPTION

RT Date is a simple Date Object designed to be speedy and easy for RT to use

The fact that it assumes that a time of 0 means "never" is probably a bug.

METHODS

sub Set

takes a param hash with the fields 'Format' and 'Value'

if $args->{'Format'} is 'unix', takes the number of seconds since the epoch

If $args->{'Format'} is ISO, tries to parse an ISO date.

If $args->{'Format'} is 'unknown', require Time::ParseDate and make it figure things out. This is a heavyweight operation that should never be called from within RT's core. But it's really useful for something like the textbox date entry where we let the user do whatever they want.

If $args->{'Value'} is 0, assumes you mean never.

SetToMidnight

Sets the date to midnight (at the beginning of the day) GMT Returns the unixtime at midnight.

Diff

Takes either an RT::Date object or the date in unixtime format as a string

Returns the differnce between $self and that time as a number of seconds

sub DiffAsString

Takes either an RT::Date object or the date in unixtime format as a string

Returns the differnce between $self and that time as a number of seconds as as string fit for human consumption

DurationAsString

Takes a number of seconds. returns a string describing that duration

sub AgeAsString

Takes nothing

Returns a string that's the differnce between the time in the object and now

sub AsString

Returns the object\'s time as a string with the current timezone.

sub AddSeconds

Takes a number of seconds as a string

Returns the new time

AddDays $DAYS

Adds 24 hours * $DAYS to the current time

AddDay

Adds 24 hours to the current time

sub Unix [unixtime]

Optionally takes a date in unix seconds since the epoch format. Returns the number of seconds since the epoch

ISO

Takes nothing

Returns the object's date in ISO format