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
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?

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.