You are here:  » Issue with Date Field


Issue with Date Field

Submitted by globologic on Sat, 2013-05-18 06:12 in

Hi,

When I run your online demo on an XML file it shows the date field as

18 May 2013 15:27:25

But when I go to insert it into mysql it goes to

0000-00-00 00:00:00

Is there a way to make it change the timestamp so it will match the SQL one?

Submitted by support on Sat, 2013-05-18 08:09

Hi,

It looks like MySQL isn't recognising it as a valid DATETIME field, but i've just checked and it converts fine using PHP's strtotime() function, so that in conjunction with the date() function can be used to convert it into a suitable value to be inserted. To do this, where you are currently using, for example:

$record["DATE"]

...REPLACE that with:

date("Y-m-d H:i:s",strtotime($record["DATE"]))

Hope this helps!
Cheers,
David
--
MagicParser.com