CodeIgniter Forums

Full Version: Date Format
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum


Say if I'm using date and time a lot in my application, subtracting, adding and comparing them, which format would you recommend? Unix or MySQL?

Thanks. To give you an idea it's for a calendar and todo list. E.g. x days to complete y. Find tasks between x and y dates.

El Forum

If you plan to do the actions in sql statements i think it's best to choose the mysql format. If you plan to do the actions in php it's best to choose unix.

I would go for the mysql format and keep the actions as close to the data as possible.

El Forum

[eluser]Sean Murphy[/eluser]
For now I store dates in a DATETIME field in MySQL and use unix timestamps in my application. I have nifty functions in my models that transparently do the conversion for me.