Barry King > Apache-Wyrd > Apache::Wyrd::Interfaces::Dater

Download:
Apache-Wyrd-0.98.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.98   Source  

NAME ^

Apache::Wyrd::Interfaces::Dater - Specialized Wyrd Date subroutines

SYNOPSIS ^

        use base qw(Apache::Wyrd::Intefaces::Dater Apache::Wyrd);

        sub _format_output {
                my ($self) = @_;
                my $publication_date = $self->{published} || $self->num_today;
                my $visible_date = $self->_date_string($publication_date);
                my $data = $self->_data();
                $data =~ s/PUBLICATION_DATE/$visible_date/g;
                $self->_data($data);
        }

DESCRIPTION ^

Several Wyrds in the Apache::Wyrd::Site class use digits 0-9 in a string: YYYYMMDD to store arbitrary dates, as they allow dates to be easily sorted and stored in a platform-independent manner. These are subroutines to manipulate dates stored in this format.

These are a minimal set of functions meant to only be used by Wyrd Classes. Unless you are writing code to closely integrate with them, you probably want to use Date::Calc or Posix instead. They are included in Apache::Wyrd for no other reason than to reduce the number of required modules.

METHODS ^

_this_year

The current year in four digits.

_num_today

Today's date in eight digits.

_num_add_ymd

Add two dates. Expects the dates to be either broken into six segments (yyyy, mm, dd, yyyy2, mm2, dd2), or three segments and an arbitrary date, or three segments, in which case the date is added to today.

_num_yesterday

Yesterday's date in eight digits.

_num_tomorrow

Tomorrow's date in eight digits.

_num_year

Interpret digital values for arguments y, m, d, and return an eight digit date.

_normalize_year

Given a year in digits (2 or 4 are best), attempt a guess as to which year is meant. Uses the simple 50-year window method for interpreting 2 digit years. Used internally.

_mmddyy2mysql

Turn an american-style six-digit year into one in mysql default format.

_yyyy2mysql

Turn a four-digit year into one in mysql default format.

_mmddyy2mysql

Turn an american-style eight-digit year into one in mysql default format.

_date_string

Turns one or two eight-digit dates into an american-style date text. When given two dates, expresses this as a range, such as 2-3 November, 2001.

AUTHOR ^

Barry King <wyrd@nospam.wyrdwright.com>

SEE ALSO ^

Apache::Wyrd

General-purpose HTML-embeddable perl object

LICENSE ^

Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.

See LICENSE under the documentation for Apache::Wyrd.

syntax highlighting: