Jump to content

What's the quickest most efficient way to change date format??


Recommended Posts

$date = '03-02-2011';
echo strtoupper(date('d-M-Y', strtotime($date)));


THis returns 31-DEC-1969 and that is definately not the date in teh $date variable.


I've tested that locally, and it works fine with php 5.2.11. What do you get if you echo your $date variable before passing it through the functions?

Link to comment
Share on other sites

I think this will serve best as to help me figure this out...



$start = $_GET['start']; //02-23-2011 is the date passed in this $_GET[];

//Convert dates to ORACLE format

$start2 = date_format($start, 'd-M-Y');
$end = strtoupper(date('d-M-Y', strtotime('today')));

echo $start;
echo " -=- ";
echo $end;

echo "<BR><BR>";

echo $start2; // Should be ORACLE FORMAT
echo " --- ";
echo $end;

Link to comment
Share on other sites

OK problem solved... i was passing 02-23-2011 which aparently confuses the heck out of php.. if i pass 23-02-2011 it works fine.

i guess the given format has to be month day year and no other way around it.

Link to comment
Share on other sites


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.