|
Posted by mantrid on 11/12/07 00:21
Thanks will give it a go
Ian
"ZeldorBlat" <zeldorblat@gmail.com> wrote in message
news:1194797386.921008.62810@d55g2000hsg.googlegroups.com...
> On Nov 11, 10:15 am, "mantrid" <ian.dan...@virgin.net> wrote:
> > "mantrid" <ian.dan...@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.
>
> Use strtotime() and date():
>
> date('Y-m-d', strtotime($dateandtime));
>
Navigation:
[Reply to this message]
|