wattsup88 Posted January 6, 2007 Share Posted January 6, 2007 I have a date that i need to work with, but in my database it is entered like 2006-03-07... i need to know how to "cut" all of the hyphens out of the date returned by the database... that way i can write a script to delete all of the rows with an expired date... Thanks,Jacob Quote Link to comment Share on other sites More sharing options...
paul2463 Posted January 6, 2007 Share Posted January 6, 2007 try using <a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html">DATE_FORMAT()</a> you can the format the date exactly as you want it when you pull it from the database. Quote Link to comment Share on other sites More sharing options...
taith Posted January 6, 2007 Share Posted January 6, 2007 $date='2006-03-07';$date=str_replace("-", "", "$date");echo $date; #20060307edit: just as a note its MUCH easier to have date(z) in the database, expire, remove that way... ;-) Quote Link to comment Share on other sites More sharing options...
wattsup88 Posted January 6, 2007 Author Share Posted January 6, 2007 Thanks so much guys oh and just so you know taith I won't be using the database I'm creating it for someone else... I of course want it to be user friendly, and I don't always have the knowledge to make it user friendly and practical. So I figured this would be the best way... again thanks for the help... 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.