vicodin Posted November 29, 2008 Share Posted November 29, 2008 Hello all... I am going to have the following format of time in my db. I would like to just be able to get the time out of it... How would i do that? Date Format: 2008/08/27 Quote Link to comment Share on other sites More sharing options...
dezkit Posted November 29, 2008 Share Posted November 29, 2008 ... So you are trying to get the time out of a date, isn't that like making a bottle of pepsi appear out of nowhere? Quote Link to comment Share on other sites More sharing options...
vicodin Posted November 29, 2008 Author Share Posted November 29, 2008 lol sorry i meant i just want the 2008 out of the 2008/08/27 ... Quote Link to comment Share on other sites More sharing options...
dezkit Posted November 29, 2008 Share Posted November 29, 2008 <?php $date = "2008/08/27"; $pieces = explode("/", $date); echo $pieces[0]; ?> Quote Link to comment Share on other sites More sharing options...
vicodin Posted November 29, 2008 Author Share Posted November 29, 2008 i went this way... $date = "2008/08/28"; $date = substr($date,0,4); thanks for the reply though. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 29, 2008 Share Posted November 29, 2008 It would be much simpler to store the date in a "DATE" field with the format YYYY-MM-DD, then you can use the MySQL routines to return just the year. Ken 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.