I have a PHP site that gets date from the user in human-form (e.g. 2012-10-18 or some such) and stores them in a database. In the database they are stored as unix timestamps. I can either use PHP functions to do the converting, and just store/retrieve the timestamps, or I can use SQL/database functions to do the converting in the query, and store/retrieve the formatted date.
Is there a reason to prefer one method over the other? Is one of these more “correct” (separation of concerns etc.)?
I have a PHP site that gets date from the user in human-form (e.g.
Share
I found that trying to handle user timezones was complicated in SQL (at least in SQLite, not sure if other databases have better timezone support in their date functions), so PHP seems to be the better place to handle this.