Date comparison function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ming Wei

    Date comparison function

    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
  • Sunder Chakravaty

    #2
    Re: Date comparison function

    weiming_168@yah oo.com (Ming Wei) wrote in message news:<e2a19db7. 0402271514.2273 32ea@posting.go ogle.com>...[color=blue]
    > 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[/color]
    "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.

    Comment

    • Gunnar Hjalmarsson

      #3
      Re: Date comparison function

      Sunder Chakravaty wrote:[color=blue]
      > Ming Wei wrote:[color=green]
      >> 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 ?[/color]
      >
      > "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.[/color]

      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

      Comment

      Working...