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

Sisimai::Time - Date and time utilities

SYNOPSIS

    use Sisimai::Time;
    my $v = 'Sat Mar  1 13:47:46 JST 2014';
    print Sisimai::Time->parse( $v );  # Sat, 1 Mar 2014 13:47:46 +0900

DESCRIPTION

Sisimai::Tie provide methods for dealing date and time.

CLASS METHODS

parse( Date string )

parse() convert various date format string.

    my $x = 'Fri, 9 Apr 2004 04:01:03 +0000 (GMT)';
    my $y = '27 Apr 2009 08:08:54 +0900';
    print Sisimai::Time->parse( $x );  # Fri, 9 Apr 2004 04:01:03 +0000
    print Sisimai::Time->parse( $y );  # Thu, 27 Apr 2009 08:08:54 +0900

to_second( String )

to_string() convert a string to the value of seconds like followings:

    print Sisimai::Time->to_second('1m');  # 60, 1 minute
    print Sisimai::Time->to_second('2h');  # 7200, 2 hours
    print Sisimai::Time->to_second('1d');  # 86400, 1 day
    print Sisimai::Time->to_second('1w');  # 604800, 1 week

abbr2tz( Abbr )

abbr2tz() convert a time zone abbreviation to 4 digit string of time zone.

    print Sisimai::Time->abbr2tz('JST');   # +0900
    print Sisimai::Time->abbr2tz('UTC');   # +0000
    print Sisimai::Time->abbr2tz('CDT');   # -0500

AUTHOR

azumakuniyuki

COPYRIGHT

Copyright (C) 2014 azumakuniyuki <perl.org@azumakuniyuki.org>, All Rights Reserved.

LICENSE

This software is distributed under The BSD 2-Clause License.