The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

BusyBird::DateTime::Format - DateTime::Format for BusyBird

SYNOPSIS

    use BusyBird::DateTime::Format;
    my $f = 'BusyBird::DateTime::Format';

    ## Twitter API format
    my $dt1 = $f->parse_datetime('Fri Feb 08 11:02:15 +0900 2013');

    ## Twitter Search API format
    my $dt2 = $f->parse_datetime('Sat, 16 Feb 2013 23:02:54 +0000');

    my $str = $f->format_datetime($dt2);
    ## $str: 'Sat Feb 16 23:02:54 +0000 2013'

DESCRIPTION

This class is the standard DateTime::Format in BusyBird.

It can parse the following format.

  • 'created_at' format of Twitter API.

  • 'created_at' format of Twitter Search API v1.0.

It formats DateTime object in 'created_at' format of Twitter API.

CLASS METHODS

$f = BusyBird::DateTime::Format->new()

Creates a formatter.

CLASS AND OBJECT METHODS

The following methods can apply both to class and to an object.

$datetime = $f->parse_datetime($string)

Parse $string to get DateTime object.

If given an improperly formatted string, this method returns undef. It NEVER croaks.

$string = $f->format_datetime($datetime)

Format DateTime object to a string.

AUTHOR

Toshio Ito <toshioito [at] cpan.org>