Jump to content

Turning date fields into actual dates


downah

Recommended Posts

I have got a date field in my mysql database with events, and as you know date in MYSQL uses yyyy/mm/dd but I would first like to turn this around to dd/mm/yyyy but also turn this into for example "Tuesday - May 1990" would anyone like to point me into the right direction?

 

Much appreciated!

Link to comment
Share on other sites

Thanks for the help, at the moment I am first trying to turn yyyy/mm/dd around to dd/mm/yyyy with this:

 

$date = $row['eventdate'];

  echo "<td>" . date('d-m-Y',$date) . " " . $row['starttime'] . "</td>";

 

which puts it into dd/mm/yyyy great! although it is not showing the right dates! but automatically all dates seemed to change to 01/01/1970.. know why?

Link to comment
Share on other sites

I got it to work using:

 

  echo "<td>"; 
print date('d M Y', strtotime($row['eventdate']));
echo " ";
echo $row['starttime'] . "</td>";

 

Thanks guys, although I'd still like to know why this doesn't work if anyone could point that out?

 

$date = $row['eventdate'];
$my_date = strtotime($date); 


  echo "<td>" . date('d-m-Y',$my_date) . " " . $row['starttime'] . "</td>";

Link to comment
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.