Forum: Ruby Re: parsedate doesn't work on

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Berger, Daniel (Guest)
on 2006-05-03 21:01
(Received via mailing list)
> ParseDate.parsedate(
>           => [nil, 5, 2, 20, 17, 57, "GMT", 2]
> It seems that parsedate is not able to detect the year from
> the standard
> string conversion of a date/time. Is there another way to do
> this? Is it
> the same in the US as for me here in the UK? It seems rather
> inconsistent.
> Julian

It's not an issue specific to the UK:

=> "Tue May 02 13:46:27 Mountain Daylight Time 2006"
irb(main):043:0> ParseDate.parsedate(
=> [nil, 5, 2, 13, 46, 18, "Mountain", 2]

The problem is that ParseDate does not handle long time zone
names, only abbreviated forms.  Consider:

irb(main):006:0> time = "Tue May 02 13:46:27 MST 2006"
=> "Tue May 02 13:46:27 MST 2006"
irb(main):007:0> ParseDate.parsedate(time)
=> [2006, 5, 2, 13, 46, 27, "MST", 2]



This communication is the property of Qwest and may contain confidential
privileged information. Unauthorized use of this communication is
prohibited and may be unlawful.  If you have received this communication
in error, please immediately notify the sender by reply e-mail and
all copies of the communication and any attachments.
This topic is locked and can not be replied to.