----- Original Message -----
From: "NAKAMURA, Hiroshi" <nahi / keynauts.com>
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Thursday, October 17, 2002 7:01 PM
Subject: Re: Converting String to Time would be nice


> Hi,
>
> > From: Gavin Sinclair [mailto:gsinclair / soyabean.com.au]
> > Sent: Thursday, October 17, 2002 5:50 PM
>
> > Time.scanf("10/17/02 18:46:18", "%x %X")  =>  Time.now, more or less
> >
> > Comments?
> >
> > I know we have ParseDate, but ...
>
> +1 to ParseDate.
>
> "01/02/01 12:34:56" should be parsed according to
> locale.  It's overkill for Ruby to decide a single
> dateTime format, I think.

"%x %X" *is* according to locale.

I like ParseDate, but sometimes you want to parse dates that are in a weird
format, and reject anything that doesn't comply.

I've used parsedate several times, and almost every time I've had to rearrange
some of the values.  I don't mind this at all, but like I said, it's not a
perfect fit for every date-parsing situation.

Then again, I guess regular scanf would make this easy enough.

> Regards,
> // NaHi

Gavin