Softpedia
 


SCRIPTS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • PeoplePods 0.9
  • Brackets Sprint 8
  • elFinder 2.0 RC1
  • BBClone 0.6.1
  • Twitter Follow Box...
  • Multilingual Press...
  • SimplePie 1.2.1
  • TinyTips 1.2
  • SWFUpload 2.2.0.1 ...
  • Head Cleaner 1.4.2.9
  • Home > Scripts > Modules

    DateTime Format Natural 0.7

    Download button


    Downloads: 670  Tell us about an update
    User Rating:
    Rated by:
    Fair (2.3/5)
    18 user(s)
    Developer:

    Website:

    License / Price:

    Platforms:

    Databases:

    Language:

    Last Updated:

    Category:
    Steven Schubiger | More scripts
    cpan.uwinnipeg.ca
    Other Free / Open Source License 

    Windows / Linux / Mac OS / BSD / Solaris
    N/A
    Perl
    April 26th, 2008, 08:29 GMT
    C: \ Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    DateTime Format Natural description

    DateTime Format Natural module consists of a method, parse_datetime, which takes a string with a human readable date/time and creates a machine readable one.

    DateTime::Format::Natural - Create machine readable date/time with natural parsing logic

    SYNOPSIS

    use DateTime::Format::Natural;

    $parser = DateTime::Format::Natural->new; $dt = $parser->parse_datetime($date_string); @dt = $parser->parse_datetime_duration($date_string); if ($parser->success) { # operate on $dt/@dt, for example: printf("s.s.%4s s:s:s", $dt->day, $dt->month, $dt->year, $dt->hour, $dt->min, $dt->sec); } else { warn $parser->error; }"DateTime::Format::Natural" takes a string with a human readable date/time and creates a machine readable one by applying natural parsing logic.

    METHODS

    new
    Creates a new "DateTime::Format::Natural" object. Arguments to "new()" are options and not necessarily required. $parser = DateTime::Format::Natural->new( lang => '[en|de]', format => 'mm/dd/yy', prefer_future => '[0|1]' daytime => { morning => 06, afternoon => 13, evening => 20, }, );
    - "lang" Contains the language selected, currently limited to "en" (english) & "de" (german). Defaults to '"en"'.
    - "format" Specifies the format of numeric dates, defaults to '"d/m/y"'.
    - "prefer_future (experimental)" Turns ambigious weekdays/months to their futuristic relatives. Accepts a boolean, defaults to 0.
    - "daytime" A hash consisting of specific hours given for peculiar daytimes. Daytimes may be selectively changed.
    parse_datetime
    Creates a "DateTime" object from a human readable date/time string.

    $dt = $parser->parse_datetime($date_string); $dt = $parser->parse_datetime( string => $date_string, debug => 1, );
    - "string" The date string.
    - "debug" Boolean value indicating debugging mode.
    If debugging is enabled, each token that is analysed will be output to STDOUT with a trailing newline appended.Returns a DateTime object.

    parse_datetime_duration
    Creates one or more "DateTime" object(s) from a human readable date/time string which may contain timespans/durations. 'Same' interface & options as "parse_datetime()", but must be explicitly called in list context.

    @dt = $parser->parse_datetime_duration($date_string); @dt = $parser->parse_datetime_duration( string => $date_string, debug => 1, );success
    Returns a boolean indicating success or failure for parsing the date/time string given.

    error
    Returns the error message if the parsing didn't succeed.

    trace
    Returns a trace of methods which we're called within the Base class and a summary how often certain units were modified.



    TAGS:

    date format | time format | date time module | date | time | perl



    HTML code for linking to this page:


    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM