play_ Posted April 19, 2009 Share Posted April 19, 2009 I store a date in a 'DATE' column type in my SQL database, in the following format YYYY-MM-DD. I'd like to retrieve it and output it out as (ie. May 05, 2009). How can I accomplish this? I could store it as a timestamp in a varchar field, but i will eventually need to compare dates, so field type can't be varchar. Quote Link to comment https://forums.phpfreaks.com/topic/154767-solved-date-help/ Share on other sites More sharing options...
DarkSuperHero Posted April 19, 2009 Share Posted April 19, 2009 how about looking into the DateTime class? http://us.php.net/manual/en/datetime.format.php Quote Link to comment https://forums.phpfreaks.com/topic/154767-solved-date-help/#findComment-813866 Share on other sites More sharing options...
jamesxg1 Posted April 19, 2009 Share Posted April 19, 2009 $date = date('M d, Y',strtotime("YOUR VAR HERE")); Quote Link to comment https://forums.phpfreaks.com/topic/154767-solved-date-help/#findComment-813872 Share on other sites More sharing options...
play_ Posted April 19, 2009 Author Share Posted April 19, 2009 Chirst. I swear i tried everything related to date() and strtotime() and didn't get it to work. Thanks all. Quote Link to comment https://forums.phpfreaks.com/topic/154767-solved-date-help/#findComment-813878 Share on other sites More sharing options...
jamesxg1 Posted April 19, 2009 Share Posted April 19, 2009 Chirst. I swear i tried everything related to date() and strtotime() and didn't get it to work. Thanks all. ok mate no problem just though i would give it a try at helping you Quote Link to comment https://forums.phpfreaks.com/topic/154767-solved-date-help/#findComment-813890 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.