[BACK]Return to Util.pm CVS log [TXT][DIR] Up to [local] / RT / Invoicing / lib / RTI

Annotation of RT/Invoicing/lib/RTI/Util.pm, Revision 1.1

1.1     ! andrew      1: package RTI::Util;
        !             2: use strict;
        !             3: use warnings;
        !             4:
        !             5: use base 'Exporter';
        !             6: use 5.010;
        !             7: use Carp;
        !             8: use DateTime;
        !             9:
        !            10: our @EXPORT_OK = qw/ ymd_to_DateTime /;
        !            11:
        !            12: sub ymd_to_DateTime {
        !            13:     my ($ymd) = @_;
        !            14:
        !            15:     return unless $ymd;
        !            16:
        !            17:     my ( $date, $time ) = split /[\sT]/, $ymd;
        !            18:     my ( $year, $month, $day ) = split '-', $date;
        !            19:     my ( $hour, $minute, $second ) = split ':', $time if $time;
        !            20:
        !            21:     return DateTime->new(
        !            22:         year      => $year,
        !            23:         month     => $month,
        !            24:         day       => $day,
        !            25:         hour      => $hour || 0,
        !            26:         minute    => $minute || 0,
        !            27:         second    => $second || 0,
        !            28:         time_zone => 'local',
        !            29:     );
        !            30: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>