Time.now.strftime("%x %X") => “10/17/02 18:46:18”
Time.scanf(“10/17/02 18:46:18”, “%x %X”) => Time.now, more or less
Comments?
I know we have ParseDate, but …
···
–
Gavin Sinclair Software Engineer
Sydney, Australia Soyabean Software Pty Ltd
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.
Regards,
// NaHi
Hi,
“Gavin Sinclair” gsinclair@soyabean.com.au wrote in message
news:08a401c275ba$01af2ea0$666332d2@nosedog…
Time.now.strftime(“%x %X”) => “10/17/02 18:46:18”
Time.scanf(“10/17/02 18:46:18”, “%x %X”) => Time.now, more or less
Comments?
I know we have ParseDate, but …
require ‘time’
Time.parse(“10/17/02 18:46:18”) # => Time.now, more or less
Park Heesob
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
···
----- 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 6:08 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.
My apologies. I completely missed the point… You need
strptime implementation in Ruby, right? IIRC, Funaba-san
who developed current version of parsedate.rb were
talking about such a plan. I don’t know the current
status…
Regards,
// NaHi