2009/10/1 tashfeen.ekram <[email protected]>: > > Is there a way to figure out if a given timezone is in daylight > savings? > > I have a reminder system setup that allows users to setup reminders > (daily, weekly, monthly, or yearly) however it does not currently > account for daylight savings. I am not exactly sure how to do this but > here is what I was thinking. I stored the time they want to get the > reminder as a datetime but only pay attention to the portions that i > need to. For example, on the daily reminders i dont pay attention to > the date, month, and year. I also store each users timezone. I have a > cron job that runs through all of the reminders setup and if the time > has come across then it sends off a reminder. This all works except i > dont account for daylight savings. I did not even have to worry about > timezones except on the UI end as everythign is stored in UTC and i do > my comparisons in UTC. However, it seems like I will need to look at > if a given user resides in a timezone that is in daylight savings and > adjust the time if necessary. Does that sound right? Is there a way to > see if a given timezone is currently in day light saving? >
If you have the local time in a known time zone put it into a ruby Time object (which, confusingly, includes a date) then you can use dst? to determine whether it is in dst or not. Colin --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

