Is there a way to ignore DST?

I want to save my datetime and display it using a user’s TimeZone
ignoring DST at all times. Is this possible?

See if TimeZone.period_for_local works for you. It has a DST=false
parameter.http://tzinfo.rubyforge.org/doc/classes/TZInfo/Timezone.html#M000051

On Mar 30, 2:06pm, Coderama [email protected] wrote:

I want to save my datetime and display it using a user’s TimeZone
ignoring DST at all times. Is this possible?

Rather than storing a timezone string you could just store the offset,
so since I’m in “Central Time US & Canada” I would just use “-0600”
which would avoid DST when we switch to -0500.

On 30 March 2011 20:06, Coderama [email protected] wrote:

I want to save my datetime and display it using a user’s TimeZone
ignoring DST at all times. Is this possible?

Do you know what the user’s timezone is? If so then take the timezone
offset (which is distinct from the DST setting) and calculate the time
accordingly.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs