Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't think its fair to say one should "never work with local times". I frequently work with "floating time", the opposite of "fixed time".

You can accept user input as (year, month, day, hour, minute, second), convert to a common timezone, and store as seconds since epoch. To display, convert back to the common timezone, but omit the timezone identifier. This is useful for events which are local for the user, since they don't care about their own timezone.

See the iCalendar spec,

They are used to represent the same hour, minute, and second value regardless of which time zone is currently being observed. For example, an event can be defined that indicates that an individual will be busy from 11:00 AM to 1:00 PM every day, no matter which time zone the person is in. In these cases, a local time can be specified.

http://www.kanzaki.com/docs/ical/dateTime.html



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: