View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Damjan Pelemis > RWDE > RWDE::Time



Annotate this POD


Open  1
View/Report Bugs
Module Version: 516   Source  

RWDE::Time ^

Class for performing time related queries. RWDE doesn't use any external perl libraries, instead it queries the database set up in the project configuration file.

fetch_time({ timestamp, interval })

Fetch a calculated date. Provided a timestamp and the desired interval the database will be queried and the resulting calculation returned back. An added bonus is that the standard sql for dates can be used here when passing your parameters.

For example, to return the timestamp representing 5 days for right now:

RWDE::Time->fetch_time({ timestamp => 'now()', interval => "5 days"});

fetch_difference({ start_stamp, stop_stamp })

Fetch the number of days elapsed between two dates. Provided a start and stop date return the number of full days that have passed between the two. An added bonus is that the standard sql for dates can be used here when passing your parameters.

Note the parameters can be formatted as timestamps but the method will cast them to dates anyway. If you are looking for the total elapsed time between two timestamps use fetch_exact_difference.

For example, to return how many days have passed since New Years 2008:

RWDE::Time->fetch_diff({ start_stamp => '01/01/2008 00:00:00', stop_stamp => 'now()' });

is_before({ start_stamp, stop_stamp })

Returns true if start_stamp is before stop_stamp, false otherwise


Fetch the timestamp that currently represents exactly "now".

This is useful for timestamping events within the system, etc.

RWDE::Time->now() would returns a timestamp that conforms to your database default timestamp representation


This is a macro to fetch_diff whereby the ending timestamp is always represented by the current date.

This simply returns back the number of days that have passed between the start stamp and the time when the method is executed.


Generate a time hash that represents the timestamp parameter.

The method parses through the timestamp and separates each of the timestamp components into a separate key. date, time, year, month, and day are all represented within the time hash


Generate a qdate from the passed in timestamp parameter.


Generate an RFC 822 formatted date from the passed in timestamp parameter.

RSS requires this specific RFC date formatting


Generate an arbitrary human readable date from the passed in timestamp parameter.

The returned date formating is: YYYY-MM-DD HH12:MI:SS TZ


Determine the day of week of a given timestamp parameter


Take a database timestamp and make it look nice for humans to read.

This is for Postgres database which tack on a numeric timezone.

syntax highlighting: