Link to home
Start Free TrialLog in
Avatar of maccaj51
maccaj51Flag for Afghanistan

asked on

Php changing date format

Hi Experts,

I need to convert the date formatted like this:
Friday 28 October 2011
to
YYYY-MM-DD

Many Thanks
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Date("Y-m-d") is probably what you want, or date('c')
ASKER CERTIFIED SOLUTION
Avatar of Matt
Matt
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This works.  You might want to use date_default_timezone_set() depending on where your clients and servers are located.

Best regards, ~Ray
<?php // RAY_temp_maccaj.php
error_reporting(E_ALL);


$in = 'Friday 28 October 2011';
echo date('Y-m-d', strtotime($in));

Open in new window

Avatar of maccaj51

ASKER

Thanks Guys... Sorry Ray I just used the first one... Thank you for your response though