NAME
App::Dochazka::REST::Util::Timestamp - date/time-related utilities
VERSION
Version 0.135
SYNOPSIS
Date/time-related utilities
use App::Dochazka::REST::Util::Timestamp;
...
EXPORTS
This module provides the following exports:
$today
(string), e.g. '2014-07-09'$today_ts
(string), e.g. '2014-07-09 00:00:00'$yesterday
(string), e.g. '2014-07-08'$yesterday_ts
(string), e.g. '2014-07-08 00:00:00'$tomorrow
(string), e.g. '2014-07-10'$tomorrow_ts
(string), e.g. '2014-07-10 00:00:00'- split_tsrange (function)
- canonicalize_ts (function)
- subtract_days (function)
- tsrange_equal (function)
FUNCTIONS
split_tsrange
Given a database handle and a string that might be a tsrange, split it into its lower and upper bounds (i.e. into two timestamps) by running it through the SQL statement:
SELECT lower(CAST( ? AS tsrange )), upper(CAST( ? AS tsrange ))
canonicalize_ts
Given a database handle and a string that might be a timestamp, "canonicalize" it by running it through the database in the SQL statement:
SELECT CAST( ? AS TIMESTAMP )
subtract_days
Given a timestamp and an integer n, subtract n days.
tsrange_equal
Given a database handle and two strings that might be equal tsranges, consult the database and return the result (true or false).
AUTHOR
Nathan Cutler, <presnypreklad@gmail.com>