Jump to content

Recommended Posts

Hi all

 

The date format in the mysql database is yyyy-mm-dd and I want to display the date dd-mmm-yyyy

 

I have tried using the following code after having a look at other sites

 

echo ('<tr><td>'.$row[Date].(j-M-Y)'</td><td><b>Yardley</b></td>');

and I am getting the following error

 

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/fhlinux147/y/yardleyheroes.co.uk/user/htdocs/fixtures.php on line 59

 

Can anyone give me any pointers

Link to comment
https://forums.phpfreaks.com/topic/112986-solved-date-format/
Share on other sites

... and the required format is "dd-mmm-yyyy", not "d-mmm-yyyy".

 

So

echo "<tr><td>".date("d-M-Y", strtotime($row['Date']))."</td><td><b>Yardley</b></td>";

 

@br0ken, When was "yyyy-mm-dd" a unix timestamp? No need to assume, read the first post, first sentence

Link to comment
https://forums.phpfreaks.com/topic/112986-solved-date-format/#findComment-580433
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.