TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   MySQL & Databases (http://www.talkphp.com/mysql-databases/)
-   -   advice on datetime data type (http://www.talkphp.com/mysql-databases/3174-advice-datetime-data-type.html)

webosb 07-25-2008 07:30 PM

advice on datetime data type
 
I need some advice on whether I should save unix timestamps in MySQL or should I create a datetime datatype and store it like YYYY-MM-DD HH:MM:SS

I'm trying to go with the most efficient way possible. Should I have php do the math for me or should I have the mysql query do the math for me. Can anyone shine some light on this?

Thanks

Orc 07-28-2008 03:31 AM

Quote:

Originally Posted by webosb (Post 17349)
I need some advice on whether I should save unix timestamps in MySQL or should I create a datetime datatype and store it like YYYY-MM-DD HH:MM:SS

I'm trying to go with the most efficient way possible. Should I have php do the math for me or should I have the mysql query do the math for me. Can anyone shine some light on this?

Thanks


I always store Unix Timestamps for my dates/times. :) So I think you should too, cause it's much easier, just a long int. :P

maZtah 07-31-2008 03:01 PM

I'm just like Orc storing it as a UNIX TIMESTAMP as an int.

xenon 07-31-2008 09:11 PM

I also prefer to store the timestamp in the database as an int instead of a DATETIME type of field. It's less memory consuming, in the first place, and secondly, you can then format a timestamp how the hell ever you want.


All times are GMT. The time now is 03:25 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0