sivanath.nagendran Posted December 7, 2006 Share Posted December 7, 2006 Hi I am newbie to MySQL. I had done one project in that project I stored IN&Out time into MySQL database field type is timestamp. That field like this 07-06-2006 14.25.29. Now what I need, that is If is it possible for divide into two part date and time from timestamp field ? Is it possible?thanks for your helpBySivanath.N Quote Link to comment Share on other sites More sharing options...
artacus Posted December 7, 2006 Share Posted December 7, 2006 AbsolutelySELECT DATE(myTimestamp) AS myDate, TIME(myTimestamp) AS myTimeor DATE_FORMAT(myTimestamp, '%Y-%m-%d') AS myDate check out the date/time section of the mysql manual for all of your options. Quote Link to comment Share on other sites More sharing options...
fenway Posted December 9, 2006 Share Posted December 9, 2006 Sure, but why would you want to? Quote Link to comment Share on other sites More sharing options...
sivanath.nagendran Posted December 12, 2006 Author Share Posted December 12, 2006 Hi Fenway Because I am doing one project. In my project I need to seperately display the particlar date and time., thats why i am asking. Why you asking this? Is This not a normal (Good) question?send replyBySivanath.N Quote Link to comment Share on other sites More sharing options...
artacus Posted December 13, 2006 Share Posted December 13, 2006 >> Is This not a normal (Good) question?No, he's saying you'd be better off keeping it as a datetime field and just pulling the date and/or time pieces when you need them using DATE_FORMAT() or similar function. Quote Link to comment Share on other sites More sharing options...
fenway Posted December 15, 2006 Share Posted December 15, 2006 [quote author=artacus link=topic=117764.msg483726#msg483726 date=1165974908]>> Is This not a normal (Good) question?No, he's saying you'd be better off keeping it as a datetime field and just pulling the date and/or time pieces when you need them using DATE_FORMAT() or similar function.[/quote]Correct -- you don't store information in a DB for display purposes. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.