and 1 contributors
Pinwheel::Model::Time - represents a date with a time-of-day part (1 second granularity), either in UTC or local time zone
# Constructors: $t = Pinwheel::Model::Time->new($epoch_secs[, $utc]); $t = Pinwheel::Model::Time::now([$utc]); $t = Pinwheel::Model::Time::utc($y, $m, $d, $H, $M, $S); $t = Pinwheel::Model::Time::local($y, $m, $d, $H, $M, $S); $t = Pinwheel::Model::Time::now_0seconds([$utc]); # same as 'now' but with the 'seconds' field zeroed $t2 = $t->getutc; # $t but in UTC $t2 = $t->getlocal; # $t but in local time zone $t2 = $t->add($secs); # add $secs seconds to $t; preserve UTC/Local # Accessors: $t->timestamp; # seconds since UNIX epoch $t->hour; # 0..23 $t->min; # 0..59 $t->sec; # 0..59 # Formatters: $t->hh_mm; # "00:00".."23:59" $t->hh_mm_ss; # "00:00:00".."23:59:59" $t->rfc822; # e.g. "Mon, 01 Sep 2008 12:34:56 GMT" (always GMT) $t->iso8601; # e.g. "2008-09-01T12:34:56Z" or "2008-09-01T12:34:56+01:00" $t->iso8601_ical; # e.g. "20080901T123456Z" or "20080901T123456" $t->toJson; # ? $t->sql_param; # Database formatting, e.g. "2008-05-31 06:30:00" (always UTC) $t->route_param; # ? # Conversion: $d = $t->to_date; # Convert to Pinwheel::Model::Date # See Pinwheel::Model::DateBase for additional methods
Assumes that the only non-UTC time zone is +01:00.
A&M Network Publishing <DLAMNetPub@bbc.co.uk>