Ruby on Rails Tuesday, February 26, 2013

Ok, I think I've come up with 2 solutions.

1. Go with Javascript http://www.datejs.com/
Date.parse("2013-03-09").getUTCOffset() // "-0800"
Date.parse("2013-03-10").getUTCOffset() // "-0700"

2. Parse it in ruby
Time.parse("2013-03-09 20:00:00").localtime.strftime("%z") # "-0800"
Time.parse("2013-03-10 20:00:00").localtime.strftime("%z") # "-0700"



In case anyone else comes across this. I'm just praying this works
internationally O_o

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment