#Should I be storing dates in utc?

9 messages · Page 1 of 1 (latest)

autumn compass
#

Lets say I have a venue booking form that requires start date and end date for an event, users can only book full day events. So should I be storing these dates in utc or local time?

cosmic merlinBOT
#

This post has been reserved for your question.

Hey @autumn compass! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

small gull
#

It's more complicated than that. The concept of date is not timezoned. One given date doesn't start at the same time everywhere in the world, nor does it end at the same time, but it's still the same date

#

So it would depend on your column type, if it doesn't have a time component, then in principle time zones should not intervene, and if it does anyway, that's more the database engine being nonsensical

grizzled dome
#

It's a good practice to always store UTC timestamps, and just let the front-end handle converting it to the user's locale.

autumn compass
autumn compass
small gull