Víctor A. Rodríguez
and 1 contributors

NAME

Twitter::Date - Helper for Twiter date management

SYNOPSIS

 use Twitter::Date;
 use Error qw(:try);

 try { 
         my $date = Twitter::Date->new('Thu Dec 09 19:50:41 +0000 2010');
         if ( $date->gt($meetingDate) ) {
                sendMail( "Ooops, I'm arriving late" );
         }
 }
 catch Twitter::NoDateError with {
         manageError( "no date, sorry" );
 }
 

DESCRIPTION

When needing to work with dates returned by Twitter in its timelines it's better to encapsulate the behaviour to manipulate them. This is what this package is for.

INTERFACE

new

Creates a new Twitter::Date object

options

  • date (mandatory)

    String date

getSeconds

Returns the seconds for the current date

getMinutes

Returns the minutes for the current date

getHour

Returns the hours for the current date

getDay

Returns the day for the current date

getMonth

Returns the month for the current date

getYear

Returns the year for the current date

getTimeZone

Returns the time zone for the current date

eq

Compares the current date with the one in the argument (also a Twitter::Date object) Returns 1 if they are equal or 0 otherwise.

options

  • date (mandatory)

    Twitter::Date object

lt

Compares the current date with the one in the argument (also a Twitter::Date object) Returns 1 if the current one is less than the argument and 0 otherwise.

options

  • date (mandatory)

    Twitter::Date object

gt

Compares the current date with the one in the argument (also a Twitter::Date object) Returns 1 if the current one is greater than the argument and 0 otherwise.

options

  • date (mandatory)

    Twitter::Date object

cmp

Compares the current date with the on in the argument (also a Twitter::Date object) Returns -1, 0, or 1 depending on whether the passed date is grater than, equal to, or less than the date in the argument. Very useful to be used in sort()

options

  • date (mandatory)

    Twitter::Date object

AUTHOR

Victor A. Rodriguez (Bit-Man)

SEE ALSO

Error (exception catching and management)