Forum: Ruby PST/PDT with DateTime.parse

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!
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.