excl209 Posted June 12, 2007 Share Posted June 12, 2007 Hello, when I echo my date variable I get 2007-06-12 00:00:00... how do I get rid of the time? 00:00:00 Many thanks, excl209 Quote Link to comment https://forums.phpfreaks.com/topic/55281-solved-date-format-should-be-easy/ Share on other sites More sharing options...
paul2463 Posted June 12, 2007 Share Posted June 12, 2007 have a look here at the <a href="http://uk.php.net/date"> MANUAL </a> tells you how to format dates into any way you like Quote Link to comment https://forums.phpfreaks.com/topic/55281-solved-date-format-should-be-easy/#findComment-273230 Share on other sites More sharing options...
mjlogan Posted June 12, 2007 Share Posted June 12, 2007 I would also guess you are not storing it as a timestamp. the strtotime function may also be helpful. Quote Link to comment https://forums.phpfreaks.com/topic/55281-solved-date-format-should-be-easy/#findComment-273235 Share on other sites More sharing options...
akitchin Posted June 12, 2007 Share Posted June 12, 2007 if you're pulling from a MySQL database, you can use the DATE_FORMAT() to operate directly on the column. might as well use MySQL for what it's worth than extracting data in an unsuitable format then using PHP to parse it: http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html Quote Link to comment https://forums.phpfreaks.com/topic/55281-solved-date-format-should-be-easy/#findComment-273240 Share on other sites More sharing options...
lewis987 Posted June 12, 2007 Share Posted June 12, 2007 i guess youve got something like this: $datetime=date("y/m/d h:i:s"); or: date("y/m/d h:i:s"); try this: $date=date("y/m/d"); just use the variable $date whereever you want the date to be Quote Link to comment https://forums.phpfreaks.com/topic/55281-solved-date-format-should-be-easy/#findComment-273255 Share on other sites More sharing options...
excl209 Posted June 13, 2007 Author Share Posted June 13, 2007 $date=date("y/m/d"); Works perfectly... thanks for your help! Excl209 Quote Link to comment https://forums.phpfreaks.com/topic/55281-solved-date-format-should-be-easy/#findComment-273611 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.