* Dean Thayer ([EMAIL PROTECTED]) [05 Nov 2003 11:04]:
> Is anyone working on a module to convert time strings in the format
> used by Tivoli Enterprise Console to DateTime objects?  I was going to
> do so, and I figured I would check. Also, would you want that module
> included in the DateTime bundle, or should I simply put it in the
> Tivoli::TEC module I was planning on writing?  The Tivoli Enterprise
> Console date string format in strftime(3c) format is:

> %h %e %k:%M:%S %Y

Hmm. This right?

package DateTime::Format::Tivoli;

use DateTime::Format::Builder
    parsers => {
        parse_datetime => {
            strptime => '%h %e %k:%M:%S %Y',
        },
    }
;

sub format_datetime
{
    my ($self, $dt) = @_;
    my $z = $dt->clone->set_time_zone( 'GMT' );
    return $z->strftime( '%h %e %k:%M:%S %Y' );
}

1;
__END__


cheers,
-- 
Iain.

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to