[thelist] Converting date format with PHP
Beau Hartshorne
beau at members.evolt.org
Fri Sep 21 00:04:08 CDT 2001
Try this:
<?php
function changeDate ($inputDate) {
$split = explode("/", $inputDate);
$outputDate = "" . $split[2] . "/" . $split[1] . "/" . $split[0];
Return $outputDate;
}
echo changeDate ("DD/MM/YYYY");
?>
That's just one of the many ways to change a date with php...
Cheers,
Beau
> Howdy y'all
>
> Well, going straight to the point: I have a date that is
> typed by the user
> in the format dd/mm/yyyy, that is the user's birthdate
> (Brazilian date
> format). So my birthday date would be 31/03/1982 . The
> problem is that
> MySQL saves dates in the yyyy/mm/dd format, so I need to
> convert the birth
> date to MySQL's format.
> Does anybody have a function?
>
> Thank you in advance,
>
> Eduardo Bacchi Kienetz
> Webmaster www.camobi.com (hobby :)
> Development/Support Dept. of ICONEWEB
> www.iconeweb.com.br (the company I work for)
More information about the thelist
mailing list