jadedchron Posted February 26, 2008 Share Posted February 26, 2008 Wednesday, 31st December, 1969 04:00:00 pm is what I'm getting returned from the MySQL database and I'm not sure why. I'm guessing it's based on a Unix timestamp and my PHP function is not formatted properly, but from what I can see from the manual it looks ok. The column type is DateTime. date("l, jS F, Y h:i:s a", $row['date']) Do I need to add specific math in the date function for it to return properly to the current date? Thank you. Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 26, 2008 Share Posted February 26, 2008 I don't think I see what you are trying to do? Could you explain what you would like to happen/what you are attempting to do here? Quote Link to comment Share on other sites More sharing options...
revraz Posted February 26, 2008 Share Posted February 26, 2008 Sounds like $row['date'] has the wrong value in it. Quote Link to comment Share on other sites More sharing options...
jadedchron Posted February 27, 2008 Author Share Posted February 27, 2008 Thanks for the replies guys. Not sure why I didn't receive email notifications. echo $raw['date'] gives me "2008-02-26 13:09:47" which is the same as what's in the DB. I'm trying to turn that into a friendlier format such as February 26th, 2008. I wouldn't mind omitting the time to be honest. Any ideas? Thanks, Nick Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 27, 2008 Share Posted February 27, 2008 You're just trying to display todays current date in that format? Such as: echo "date(F jS, Y)"; Or am I still lost and confused? Quote Link to comment Share on other sites More sharing options...
revraz Posted February 27, 2008 Share Posted February 27, 2008 You are trying to convert a Unix time, but using a MySQL time. Use strtotime http://www.thescripts.com/forum/thread588691.html Quote Link to comment Share on other sites More sharing options...
jadedchron Posted February 28, 2008 Author Share Posted February 28, 2008 Thanks for the replies. date('m-d-Y', (strtotime($row['date']))) Seems to do the trick, thanks a lot! Nick Quote Link to comment Share on other sites More sharing options...
themistral Posted February 28, 2008 Share Posted February 28, 2008 If your problem is fixed, please remember to mark the thead as solved. Quote Link to comment Share on other sites More sharing options...
aebstract Posted February 28, 2008 Share Posted February 28, 2008 If your problem is fixed, please remember to mark the thead as solved. The button isn't there/is broken. 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.