unemployment Posted May 27, 2011 Share Posted May 27, 2011 I can't seem to get the syntax correct I want my date outputted as January 1st. <span class="goal_head f_right mrm"><?php echo date($goal['complete_date'], 'F j'); ?></span> Quote Link to comment https://forums.phpfreaks.com/topic/237656-format-date/ Share on other sites More sharing options...
The Little Guy Posted May 27, 2011 Share Posted May 27, 2011 reverse the two parameters. $goal['complete_date'] must also be a unix timestamp Quote Link to comment https://forums.phpfreaks.com/topic/237656-format-date/#findComment-1221223 Share on other sites More sharing options...
QuickOldCar Posted May 27, 2011 Share Posted May 27, 2011 echo date('F jS'); Quote Link to comment https://forums.phpfreaks.com/topic/237656-format-date/#findComment-1221227 Share on other sites More sharing options...
mikesta707 Posted May 27, 2011 Share Posted May 27, 2011 echo date('F jS'); this woudn't use the timestamp that OP has retrieved from the database. This would simply print the current date. As TLG said, OP simply needs to reverse his parameters. He has them in the wrong order. Like so: <span class="goal_head f_right mrm"><?php echo date('F j', $goal['complete_date']); ?></span> Quote Link to comment https://forums.phpfreaks.com/topic/237656-format-date/#findComment-1221228 Share on other sites More sharing options...
QuickOldCar Posted May 27, 2011 Share Posted May 27, 2011 and then can add the S so can have the way asked for correct Quote Link to comment https://forums.phpfreaks.com/topic/237656-format-date/#findComment-1221230 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.