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



Annotate this POD

View/Report Bugs
Module Version: 0.98   Source  


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


        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;


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.



The current year in four digits.


Today's date in eight digits.


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.


Yesterday's date in eight digits.


Tomorrow's date in eight digits.


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


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.


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


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


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


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.


Barry King <>



General-purpose HTML-embeddable perl object


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

See LICENSE under the documentation for Apache::Wyrd.

syntax highlighting: