Posted by boclair on 01/11/07 04:06
Vincent Delporte wrote:
> Hello
>
> My site is hosted on a server in the US, hence set up to use
> the mm/dd/yyyy date format instead of the European dd/mm/yyyy.
>
> Also, MySQL stores dates as yyyy-mm-dd, so I need to convert
> dd/mm/yyyy to that format.
> --------------------
> //In the form dd/mm/yyyy
> $dateorig = $_POST["dateorig"];
>
> //Doesn't work because server set up to assume mm/dd/yyyy!
> $new_dateorig = date("Y-m-d", strtotime($dateorig));
>
> print $new_dateorig;
> --------------------
$dateorig = "03/21/2005";
$new_dateorig = date("Y-m-d", strtotime($dateorig));
print $new_dateorig;
reports 2005-03-21.
Louise
[Back to original message]
|