package RT::Date; use Time::Local; use RT::Base; use strict; use vars qw/@ISA/; @ISA = qw/RT::Base/; use vars qw($MINUTE $HOUR $DAY $WEEK $MONTH $YEAR); $MINUTE = 60; $HOUR = 60 * $MINUTE; $DAY = 24 * $HOUR; $WEEK = 7 * $DAY; $MONTH = 4 * $WEEK; $YEAR = 365 * $DAY; # {{{ sub GoBackSeconds =head2 sub GoBackSeconds Takes a number of seconds as a string Returns the new time =cut sub GoBackSeconds { my $self = shift; my $delta = shift; $self->Set(Format => 'unix', Value => ($self->Unix - $delta)); return ($self->Unix); } # }}} # {{{ sub GoBackDays =head2 GoBackDays $DAYS delete 24 hours * $DAYS to the current time =cut sub GoBackDays { my $self = shift; my $days = shift; $self->GoBackSeconds($days * $DAY); } # }}} # {{{ sub GoBackDay =head2 GoBackDay Adds 24 hours to the current time =cut sub GoBackDay { my $self = shift; $self->GoBackSeconds($DAY); } # }}} 1;