|
Posted by mantrid on 11/11/07 15:15
"mantrid" <ian.dandav@virgin.net> wrote in message
news:9xCZi.21578$6v.8195@newsfe2-gui.ntli.net...
> Im reading a csv file with php and getting a date in the form 30/09/07
>
> Which I am trying to insert into a mysql table which has the field
formatted
> as yyyy-mm-dd hh:mm:ss
> I cant get it to insert the field remains blank
> How do I do this?
>
>
I was able to work around the problem using
$datebits = explode("/", $dateandtime);
$dateandtime = date('Y-m-d
H:i:s',mktime(00,00,00,$datebits[1],$datebits[0],$datebits[2]));
However, if there is a simple single function I can use, or if anyone knows
a better way please let me know as users may not use the dd/mm/yyy format
but could use something along the lines of dd-mm-yyyy or any other style.
Navigation:
[Reply to this message]
|