Forum: Ruby PST/PDT with DateTime.parse

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
78b02344e6646fcc3055a5c93e81531a?d=identicon&s=25 Refael Dakar (refaelos)
on 2016-08-30 11:41
Hey,

I want to be able to parse a date string which might be in PST or PDT
according to daylight savings. This means that half a year the date will
be PST and the other half the date will be PDT.

This is my code now:

DateTime.parse('2016-02-21 10:00:02 PST/PDT')

This will only parse the date as PST (GMT-8).

How can I parse a date+time in PST/PDT automatically?

Thanks!
This topic is locked and can not be replied to.