Charles N. Owens > Myco-0.01 > Myco::Util::DateTime

Download:
Myco-0.01.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.01   Source   Latest Release: Myco-1.22

NAME ^

Myco::Util::DateTime - a Myco entity class

VERSION ^

Release

0.01

Repository

$Revision$ $Date$

SYNOPSIS ^

  use Myco;

  # Constructors. See Myco::Base::Entity for more.
  my $obj = Myco::Util::DateTime->new;

  # Accessors.
  my $value = $obj->get_fooattrib;
  $obj->set_fooattrib($value);

  $obj->save;
  $obj->destroy;

DESCRIPTION ^

Blah blah blah... Blah blah blah... Blah blah blah... Blah blah blah blah blah... Blah blah...

COMMON ENTITY INTERFACE ^

Constructor, accessors, and other methods -- as inherited from Myco::Base::Entity.

ADDED CLASS / INSTANCE METHODS ^

date

  $datetime->date('YYYY-MM-DD');

Get the current date, in several formats: YYYY-MM-DD, YY-MM-DD, MM-DD-YYYY, MM-DD-YY.

year

  my $year = $datetime->year;

Get the current year.

month

  my $month = $datetime->month;

Get the current Month.

day

  my $day = $datetime->day;

Get the current day of the month.

date_add

  $datetime->date_add($offset, $date1);

Adds an integer (positive or negative) offset to a given date. If no date is given, then the current date is used.

date_range

  my @range = $datetime->date_range('2002-06-01', '2003-06-01');
    or
  my @range = $datetime->date_range(-365, '2003-06-01');
    or
  my @range = $datetime->date_range(-365);

Returns the range of dates between two given dates (including both). Alternatively, adds an integer (positive or negative) offset to a given date and returns an array of dates for each intervening day. Starts with the most recent, and descends or ascends from there. If no date is given, the current date is used.

american

  my @american_dates = $datetime->american( @dates );
  my $isa_american_date = $american_dates[0] eq 'June 16th, 2003';

Translates ISO-format dates into an American-style dates.

syntax highlighting: