CodeIgniter Forums
Date Format - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Date Format (/showthread.php?tid=7475)



Date Format - El Forum - 04-10-2008

[eluser]Kemik[/eluser]
Hey,

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.


Date Format - El Forum - 04-10-2008

[eluser]xwero[/eluser]
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.


Date Format - El Forum - 04-11-2008

[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.