The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Pinwheel::Model::Date - represents a date (without a time-of-day part and without a time zone)

SYNOPSIS

    # Constructors:

    $d = Pinwheel::Model::Date->new($epoch_secs);

    $d = Pinwheel::Model::Date::now([$utc]);
        # if $utc is true: the current UTC date
        # otherwise (default): the current local date

    $d = Pinwheel::Model::Date::parse($str); 
        # $str can be like '2008' or '2008-05' or '2008-05-31'
        # missing parts default to "01"

    $d = Pinwheel::Model::Date::date($y[, $m[, $d]]);
        # missing parts default to 1 (Jan, 1st)

    $d = from_bbc_week($y, $w);
    $d = from_iso_week($y, $w);

    # Formatters:

    $d->iso8601;            # ISO8601 formatting, e.g. "2008-05-31"
    $d->toJson;             # ?
    $d->sql_param;          # Database formatting, e.g. "2008-05-31"
    $d->route_param;        # a hash ref, e.g. +{ year => 2000, month => 5, day => 31 }

    # Conversion:

    $t = $d->to_time;       # Convert to Pinwheel::Model::Time (using midnight local time)
    
    # Date calculations
    $d1->difference($d2);   # Returns the difference between two dates (in days)

    # See Pinwheel::Model::DateBase for additional methods

SEE ALSO

Pinwheel::Model::DateBase, Pinwheel::Model::Time.

AUTHOR

A&M Network Publishing <DLAMNetPub@bbc.co.uk>