0

In my database I have a date like 2013/11/12 and it must be converted in 12th November 2013. Here there is my code:

$a=mysqli_connect("localhost","usern","pass","my_mk7vrlist");

//as you can see I'm getting the value of the date from a MySQL database

$res= mysqli_query($a,"SELECT * FROM 0_vrs_europe ORDER BY `vrs` DESC, `date` ASC LIMIT 0 , 150");

while($row = mysqli_fetch_array($res))
  {
  echo "<tr>";
  echo "<td>" . $row['status'] . "</td>";
  echo "<td>" . $row['date'] . "</td>";
  echo "</tr>";
  }

mysqli_close($res);
?> 

The $row['date'] contains the date in 2013/11/12 format and it must be converted in 12th November 2013 as I have already said. How could I do it?

I have googled the function date but I can't understand how to use it here.

1

2 Answers 2

1
$date = date("jS F Y", strtotime($row['date']));
Sign up to request clarification or add additional context in comments.

Comments

0

Use date()s second parameter:

$formatted = date('jS F Y', strtotime($row['date']));

3 Comments

This would output 3th
you need to use S for the suffix
@cmorrissey: Yes, as I posted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.