I currently store my datetimes in UTC, and for all purposes, it's worked fine so far. But now I want to query for records created on a particular day, like today, in my own timezone, which is Eastern.
Due to the difference in hours, records I'm creating at the moment will have tomorrow's date. For instance, the date portion would currently be 2016-06-20 in my timezone, but UTC is 2016-06-21.
How could I accurately get records for a particular day in my own timezone when the records are stored as UTC? I was thinking that I could use the convert_tz function to convert the stored value to Eastern, and use that as part of my where clause. That way the dates match up. Is that a reliable solution?
Aucun commentaire:
Enregistrer un commentaire