Questions

How to convert timestamp to date in MYSQL

How to convert timestamp to date in MYSQL :-

You can convert the timestamp to date in mysql by using DATE and FROM_UNIXTIME function. The command given bellow,

FROM_UNIXTIME
> SELECT create FROM phpkit ;

The output
----------------
Created
--------------
1216053466
-------------------
> SELECT DATE( FROM_UNIXTIME( `created` ) ) AS pDate FROM phpkit

OUTPUT as follows,
------------------------------
2008-07-14
------------------------------

Your Answers

Your Name:
Your Answers :
<> is a code tag
Preview
Enter the verification code:

Answers

hobit
Feb 05 13 09:23:40
very usefull. thanks and will use it for csv-export.de

Jamie
Dec 17 12 10:34:08
Any chance of getting the time from this as well?

Stagiaire Developpeur
Sep 12 12 10:08:06
Thinks from France, you unlock me ^^

kalidasan
Jun 13 12 06:04:22
Thanks :) its working fine..

bong
Jun 07 12 08:47:12
great one

Kirtan Gajjar
May 08 12 08:15:31
Thanks a lot dear.
I use this with WHERE condition to find records between dates. ;)
Gr8 post...

Neil
Mar 26 12 06:43:22
So... I tried this and found it more useful than every other post and documentation. But, I needed hour, minute, second. Ends up taking the date() function wrapper out will cause h-m-s to show. Thought I'd share. Thanks for the post.

John
Feb 29 12 10:51:08
Thanks for posting an article on this :-)

Suleman Ahmad
Feb 17 12 05:29:09
Thanks

sam
Feb 06 12 10:03:08
Thanks a lot ! Was looking for it for ages !

Super
Feb 02 12 10:46:57
Thanx a lot - Yeah you rock!!

Rikard
Nov 24 11 08:25:38
Great! Short and easy =)

Mahendra
Oct 14 11 08:19:38
It's very useful

jimmydiadelta
Sep 26 11 07:43:12
thanks for the post, that realy helped me! Awesome

abhisk
Sep 15 11 08:30:47
ths buddy its very useful

portgaz
Jul 04 11 06:50:37
Thanks dude.

Nina
Jun 15 11 12:49:15
Thanks so much, was searching everywhere for this!

Rohit
May 30 11 09:38:04
Thanks simple very useful :)

Isabanur
May 13 11 01:13:42
The help is well appreciated am tryin to create a script to group rows per day using the timestamp column but i just cant find a way lease help if u can.

Yugant Khokhar
May 05 11 02:31:36
Thanks for this post.It is very useful :)

bokcity
Mar 14 11 06:10:04
Thanks!! Very Beautiful!

Vedprakash Bishnoi
Jan 19 11 05:23:37
Thanks its working fine.

Shawn
Nov 24 10 07:15:54
Awesome.  That did the trick.

Boris
Oct 27 10 11:56:13
Thanks! I used that to convert all timestamps in a table to mysql-dates, as follows:

UPDATE
    `tablename`
SET
    `newfield` = DATE( FROM_UNIXTIME( `oldfield` ) )

Worked great ;-)

sekar
Aug 24 10 03:55:38
Thank you, please share yours knowlege here. Thanks in advance.

squeege
Aug 19 10 10:14:55
Awesome dude thanks

chinzzzz
May 06 10 12:02:46
U rocks maaaannnnnn

Nathan
Apr 29 10 03:38:26
This was awesome thanks!

Unni
Feb 12 10 10:47:31
Hey thanks..that really helped...you rocks..

Arnaud
Jun 29 09 03:26:52
thanks for the post. Very usefull !!