Jump to content

Changing the date format of a variable


ukscotth

Recommended Posts

Hi,

 

I think this should be pretty easy for someone who knows how.

 

I have a date and time stored in a database field and when i do a simple echo it shows up like this : 1224950428

 

Is there an easy way i can make it display something like this instead : 23 March, 8:45pm

 

Many thanks in advance.

 

Scott.

 

 

Link to comment
https://forums.phpfreaks.com/topic/135056-changing-the-date-format-of-a-variable/
Share on other sites

  • 5 months later...

Would this be the same as:

 

<?php $event_date = date("F j, Y", ($row_rs_user['event_date']));

echo $event_date ; ?>

 

I ask because when I use the above code, the date displays as "December 31, 1969" even though the DB data is "2009-10-21"... Obviously, I am expecting the page to echo "October 21, 2009", but this is not what I'm getting...

 

Any thoughts on what I've done wrong?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.