bradkenyon Posted February 15, 2008 Share Posted February 15, 2008 i want 2007-06-14 to format into June 14, 2007 i tried using a bunch of different functions, mktime, date, getdate, strtotime, strptime, strftime... but some give me a date from 1970. the date is stored in the db in that format: 2007-06-14 what should i be doing... this is what i was thinking edate is the 2007-06-14 date echo ' - '.date('M D Y', str_replace('-','',$sql->f('edate'))); Quote Link to comment Share on other sites More sharing options...
craygo Posted February 15, 2008 Share Posted February 15, 2008 date("F j, Y", strtotime($sql->('edate'))); Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 15, 2008 Share Posted February 15, 2008 It's much easier to format the date with the SQL query SELECT DATE_FORMAT(edate, '%M %e, %Y') FROM tablename Quote Link to comment Share on other sites More sharing options...
bradkenyon Posted February 15, 2008 Author Share Posted February 15, 2008 print date('F j, Y', strtotime($sql->('edate'))); doesn't work. gives me the following error: Parse error: syntax error, unexpected '(', expecting T_STRING or T_VARIABLE or '{' or '$' in archives.php on line 67 Quote Link to comment Share on other sites More sharing options...
craygo Posted February 15, 2008 Share Posted February 15, 2008 well not sure how your object works so you may have to fix the syntax print date('F j, Y', strtotime($sql->f('edate'))); Ray Quote Link to comment Share on other sites More sharing options...
bradkenyon Posted February 15, 2008 Author Share Posted February 15, 2008 PERFECT! Thanks! Quote Link to comment Share on other sites More sharing options...
craygo Posted February 15, 2008 Share Posted February 15, 2008 Anytime 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.