Ramon Miguel M. Tayag
2007-Jun-16 06:38 UTC
Getting the timezone (the GMT offset) from DateTime
Hi everyone! How do you get the timezone (in the format: +0800) from a time object? Please see http://pastie.caboo.se/70979 Thank you, -- Ramon Tayag --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
liquidautumn
2007-Jun-16 07:53 UTC
Re: Getting the timezone (the GMT offset) from DateTime
%z will do the job, but... are you sure you are doing timezone related stuff in a right way? usually it is better to store your times in UTC timezone, converting back and forth to user''s, user location''s or whatever entity''s you''ll find appropriate local timezone. On Jun 16, 9:38 am, "Ramon Miguel M. Tayag" <ramon.ta...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi everyone! > > How do you get the timezone (in the format: +0800) from a time object? > > Please seehttp://pastie.caboo.se/70979 > > Thank you, > -- > Ramon Tayag--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ramon Miguel M. Tayag
2007-Jun-16 14:40 UTC
Re: Getting the timezone (the GMT offset) from DateTime
%z gives me "Malay Standard Pacific Time" (or something like that). I figured it''d be much easier to make a timezone drop down (just like all the other sites out there). "are you sure you are doing timezone related stuff in a right way?" -- Not at all :o Thanks :) On 6/16/07, liquidautumn <denis-PfseE6/LE5QxpvK4C0GaPQ@public.gmane.org> wrote:> > %z will do the job, but... > are you sure you are doing timezone related stuff in a right way? > usually it is better to store your times in UTC timezone, converting > back and forth to user''s, user location''s or whatever entity''s you''ll > find appropriate local timezone. > > On Jun 16, 9:38 am, "Ramon Miguel M. Tayag" <ramon.ta...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > Hi everyone! > > > > How do you get the timezone (in the format: +0800) from a time object? > > > > Please seehttp://pastie.caboo.se/70979 > > > > Thank you, > > -- > > Ramon Tayag > > > > >-- Ramon Tayag --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Try Time.new.localtime.strftime "%z" ? On Sat, 2007-06-16 at 14:38 +0800, Ramon Miguel M. Tayag wrote:> Hi everyone! > > How do you get the timezone (in the format: +0800) from a time object? > > Please see http://pastie.caboo.se/70979 > > Thank you,--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ramon Miguel M. Tayag
2007-Jun-23 17:49 UTC
Re: Getting the timezone (the GMT offset) from DateTime
Thanks, kates, will do :) On 6/23/07, kates <katesgasis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Try Time.new.localtime.strftime "%z" ?-- Ramon Tayag --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---