The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

BingoX::Time - Time display parent class containing generic methods

SYNOPSIS

use BingoX::Time;

CONSTRUCTORS

$BR = $proto->new( [ $time ] [, $data_object ] );

OBJECT METHODS

$date->month_full;
$date->month_full2abrv;

$date->months_list;
$date->months_full_list;

$date->months;
$date->months_pad;
$date->months_full;
$date->months_full_pad;
$date->month_abrv;

$date->int_months;
$date->int_months_full;

$date->last_day;
$date->last_days;

$date->is_leap_year;

$date->hours24;
$date->hours;
$date->minutes;

REQUIRES

strict
Date::Parse
Date::Language
Date::Language::English
Time::Object

EXPORTS

localtime, gmtime

DESCRIPTION

Time provides an OO interface to Time/Dates, ala Time::Object.

METHODS

new ( [ $time ] [, $islocal ] )

This is a Time::Object overloaded constructor that can take as values the time in seconds, or defaults to 'time'. It can also take the $islocal flag, which tells _mktime() to use localtime (1) or gmtime (0). It always returns a BingoX Time Object.

str2time ( $string )

This is method is used to parse your default date format into a format that str2time understands, such as:

Date: 961221               (yymmdd)
Date: 12-21-96             (mm-dd-yy)    ( '-', '.' or '/' )
Date: 12-June-96           (dd-month-yy) ( '-', '.' or '/' )
Date: June 12 96 00:00PM   (month dd yy hh:mmPM)
Date: June 12 96 00::00:00 (month dd yy hh:mm::ss)

If time is not passed then time defaults to 00:00:00.

time2str ( $format )

For compatibility for the older DateTime::Date modules. Passes the $format to strftime.

time_local ( )

For compatibility for the older DateTime::Date modules. Returns $self->epoch.

month_full ( )

Returns the full month string based on the integer month.

month_full2abrv ( )

Returns the abbreviated (3 char) month string based on the full month name.

months_list ( )

Returns an array ref of abbreviated months.

months_full_list ( )

Returns an array ref of months.

months ( )

Returns a hash ref of abbreviated months. With the keys being the true month value (1 .. 12).

months_full ( )

Returns a hash ref of full month names. With the keys being the true month value (1 .. 12).

month_abrv ( )

Returns a hash ref of abbreviated months. With the keys being the full month name.

int_months ( )

Returns a hash ref of abbreviated months. With the keys being the integer month value (0 .. 12).

int_months_full ( )

Returns a hash ref of full month names. With the keys being the integer month value (0 .. 12).

last_day ( [ $mon ] [, $year ] )

Returns the last day of the of the month and year passed. If nothing is passed then it uses the objects month and year. Month is the integer month 0 .. 11, and year is the 4 digit year.

last_days ( )

Returns a hash ref of the last day for each month. The keys are the integer months (0 .. 11).

is_leap_year ( )

Returns true if the year is a leap year.

hours24 ( )

Returns an array ref of hours in 24hr time.

hours ( )

Returns an array ref of hours in 12hr time. Padded with zeros.

minutes ( )

Returns an array ref of minutes (0 .. 60). Padded with zeros.

REVISION HISTORY

$Log: Time.pm,v $
Revision 1.10  2000/12/12 18:54:34  useevil
 - updated version for new release:  1.92

Revision 1.9  2000/11/15 19:38:50  useevil
 - added str2time()
 - fixed bug in new() where $time was always defined

Revision 1.8  2000/10/17 00:49:04  dweimer
Merged over thai's commit, comment below:

- added time2str() and time_local() for former users of DateTime::Date

Revision 1.7  2000/09/19 23:42:07  dweimer
Version update 1.91

Revision 1.6  2000/09/13 20:10:42  thai
 - added use Data::Language::English

Revision 1.5  2000/09/13 18:17:21  david
Data::Dumper only loaded if $debug is on.

Revision 1.4  2000/09/08 05:18:53  thai
 - added:
     month_full()
     month_full2abrv()
 - updated the POD documentation

Revision 1.3  2000/09/08 00:56:09  thai
 - fixed the POD errors per Smeg's request

Revision 1.2  2000/09/07 22:27:32  thai
 - added:
     last_day()
     last_days()
     is_leap_year()

Revision 1.1  2000/09/07 18:27:57  thai
 - has ousted DateTime::Date as the default date/time class
 - sub classes Time::Object

SEE ALSO

Time::Object, perl(1).

KNOWN BUGS

None

TODO

Nothing yet... anybody have suggestions?

COPYRIGHT

Copyright (c) 2000, Cnation Inc. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the terms of the GNU Lesser General Public License as published by the Free Software Foundation.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

AUTHORS

Thai Nguyen <thai@cnation.com>