Date comparison function

Discussion in 'Perl' started by Ming Wei, Feb 27, 2004.

  1. Ming Wei

    Ming Wei Guest

    Is there a Date module which I can use to compare Date Strings ?

    e, g. if I have the following two date strings in different format:

    Feb 9 15:00

    2004/02/18 21:29:05

    How do I convert them into a common format and then compare them to
    see which date is more current ?

    Thanks
     
    Ming Wei, Feb 27, 2004
    #1
    1. Advertising

  2. (Ming Wei) wrote in message news:<>...
    > Is there a Date module which I can use to compare Date Strings ?
    >
    > e, g. if I have the following two date strings in different format:
    >
    > Feb 9 15:00
    >
    > 2004/02/18 21:29:05
    >
    > How do I convert them into a common format and then compare them to
    > see which date is more current ?
    >
    > Thanks

    "perldoc -q date" should help. Here is a snip
    if you don't know the precise format of your
    dates, then you should probably use either of the
    Date::Manip and Date::Calc modules from CPAN
    before you go hacking up your own parsing routine
    to handle arbitrary date formats.
     
    Sunder Chakravaty, Feb 29, 2004
    #2
    1. Advertising

  3. Sunder Chakravaty wrote:
    > Ming Wei wrote:
    >> Is there a Date module which I can use to compare Date Strings ?
    >>
    >> e, g. if I have the following two date strings in different
    >> format:
    >>
    >> Feb 9 15:00
    >>
    >> 2004/02/18 21:29:05
    >>
    >> How do I convert them into a common format and then compare them
    >> to see which date is more current ?

    >
    > "perldoc -q date" should help. Here is a snip
    > if you don't know the precise format of your
    > dates, then you should probably use either of the
    > Date::Manip and Date::Calc modules from CPAN
    > before you go hacking up your own parsing routine
    > to handle arbitrary date formats.


    I wonder why it doesn't mention Date::parse, which module appears to
    be more on the spot.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Feb 29, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    1
    Views:
    649
    Matthew Speed
    Nov 8, 2003
  2. Smith Sonian

    Date Comparison function...(Jave Script)

    Smith Sonian, Sep 12, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,450
    Craig Deelsnyder
    Sep 13, 2004
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,373
    Michael Borgwardt
    May 30, 2004
  4. Matt
    Replies:
    2
    Views:
    570
    Pete Becker
    Nov 8, 2003
  5. Deepu
    Replies:
    1
    Views:
    267
    ccc31807
    Feb 7, 2011
Loading...

Share This Page