diff options
author | Ivan Kohler <ivan@freeside.biz> | 2015-09-21 02:02:21 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2015-09-21 02:02:21 -0700 |
commit | 16e69398896d4d1c0b9c1e5786bdb31b11a18519 (patch) | |
tree | e004e42edeebb684930c1c9b4e00ca4914932077 /FS/FS/Misc/DateTime.pm | |
parent | ce5f4c2396fd43608b60171464831cf2b53cc367 (diff) |
billing event to call web services, RT#35167
Diffstat (limited to 'FS/FS/Misc/DateTime.pm')
-rw-r--r-- | FS/FS/Misc/DateTime.pm | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/FS/FS/Misc/DateTime.pm b/FS/FS/Misc/DateTime.pm index 2fff906..56baec3 100644 --- a/FS/FS/Misc/DateTime.pm +++ b/FS/FS/Misc/DateTime.pm @@ -6,9 +6,10 @@ use Carp; use Time::Local; use Date::Parse; use DateTime::Format::Natural; +use Date::Format; use FS::Conf; -@EXPORT_OK = qw( parse_datetime day_end ); +@EXPORT_OK = qw( parse_datetime day_end iso8601 ); =head1 NAME @@ -65,11 +66,22 @@ same date but 23:59:59 for the time. =cut sub day_end { - my $time = shift; + my $time = shift; - my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = - localtime($time); - timelocal(59,59,23,$mday,$mon,$year); + my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = + localtime($time); + timelocal(59,59,23,$mday,$mon,$year); +} + +=item iso8601 TIME + +Parses time as an integer UNIX timestamp and returns the ISO 8601 formatted +date and time. + +=cut + +sub iso8601 { + time2str('%Y-%m-%dT%T', @_); } =back |