Time zones support in Rails is a great feature that simplifies and makes easy a task that would take too much time in other frameworks, but there are some situations in which we should take care about queries regarding utc convertions, for example, for my last rails app, I'm working with 'Americas/Bogota' (UTC -5) as default time zone to parse the time from the server time to Colombian zone and then print information about the records (created_at or updated_at) Rails makes this pretty well, but you should notify that in the database the time fields are created and saved with the current SERVER time, so in order to make queries relating the current time zone and the server time, you have to parse again the current time zone to the server time using the TZinfo local_to_utc method, otherwise, the queries eventually will not return the expected results.
Full example:
1 comments:
Pc games free
gta 4 free download
Post a Comment