Jump to content

[SOLVED] UK not US date?


the_oliver

Recommended Posts

Hello,

 

I have a date field in MySQL database.  I have to enter the date in this format: YYYY-MM-DD  so i can have the search results ordered by date.  I would however like it displaid in the uk date format DD-MM-YYYY.  How can i go about this?  Thanks!

Link to comment
Share on other sites

Ok, so i have go that

 

$today = date("F j, Y");
echo $today;

 

will give me the format October 15, 2006.  But i want to do this of a result stored in a database.  So i tried:

 

$time = 2007-03-07;
$today = date("F j, Y", $time);
echo $today;

 

(as 2007-03-07 is the format stored in the database)

 

But that gives me January 1, 1970 not March 7, 2007.  Where have i gone wrong??

 

Thanks.

 

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.