i’m wanting to display a user friendly date format, so i am changing the mysql time stamp to keep it simpler for users. I’ve already got the code which echo’s my desired date format and it works fine on other pages of my site. but i’m having trouble getting the date format to display in amongst a section of my code.
Here’s the piece of code i’m using to convert mysql date to a user friendly format:
<?php
$datesent1 = $sentbox['date_sent'];
echo date('D M jS, Y', strtotime($datesent1));?>
And this is my code i am trying to incorporate it into:
<div class="message-date">
<?php echo "Conversation Dated: {$message['date_sent']}"; ?></div>
I should probably add that i am echoing $message[‘date_sent’] to retrieve the date a message was sent to the user in a table.
can anyone tell me how this is suppose to be done. Thanks, i’m new to php and mysql so sorry if it’s a bit of a daft question.
You can either save the pretty date in a variable and print it with the message or just do it where you print it like so