INT (as unix time) all the way, I use that then just parse the output to a format I prefer.
same to me. it's universal and no need to recreate function for converting date.
INT rocks!! There are two reasons for it. most of the timestamps in other languages don't match the timestamp used MySQL. so you need to parse the timestamp that adds to the processing time and inconvinience. At the same time, it is difficult to customize the TIMESTAMP according to your wishes.
I use MySQL only with php, so i use the timestamp in php using the time() function and then store it. It is much better as you can perform arithmetic operations as and when the data is extracted.
VARCHAR is the simple one because you can use like this:
(if log is VARCHAR):
$t = date(d/m/y);
mysql_query("insert into tbl (log) values('$t')");
Well, it actually depend s on your needs ...
but i think the most flexible is using INT (as unix time)
cause you can parse it as you needs right?
am i just repeating?
I'm using DATE, just because it's meant for it (stupid reason I know)
And i extract it this way:
SELECT UNIX_TIMESTAMP(`Date`) AS `Date`
depends... date or timestamp
i'm asking you a question in reply.
i'm new in php. So, don't know much about it .Please help me.
Can someone tell me the php code so that i will get the output like this
Sunday,18 march 2008
I prefer DateTime, and use PHP's NOW() to insert the date. While extracting, I use date() to format the date according to my needs... Not much processing power required for this, i believe.
unix time stamp format, much easier to convert to anything you want with it. However, if you know you're only going to be using one format for your apps, it's probably best to use that specific format.
how to convert a date and time to INT so that it is easily convertible into date format later.
that's the linux timestamp. It's the time in seconds since the epoch (1st Jan 1970).
could you guys give a sample uses why you prefer to choose timestamp? or int(unix) ?
coz me i only use date or datetime as my date format in mysql
it will display the server time. So it doesn't matter who is looking at the site or who is the owner of the site.
I use INT to store dates if I need a timestamp. It's not always best in all situations but work very often. If the time is before 1970 it has to be stored in another way but thats rare.
DateTime with NOW() to insert and date() to extract