Jump to content

Can somebody help with this script?


ashkey

Recommended Posts

Hi there

 

I am hoping that somebody will be able to help with this script I have had written. It uploads data from a .csv file to a database, although it works fine the problem is the seconds wont upload on the date and time. If I upload 16/08/2008  00:04:40 it shows on the database table as 2008-08-16 00:04:00. I need it to show the seconds also so it reads  2008-08-16 00:04:40. I have been trying for a few days but no luck can someone help?

 

 

Thanks

 

$dobParts = split("/", $AdobSTRING);

$Adob = $dobParts[2]."-".$dobParts[1]."-".$dobParts[0];

 

$datetimeParts = split(" ", $AdatetimeSTRING);

$dateParts = split("/", $datetimeParts[0]);

$timeParts = split(":", $datetimeParts[1]);

 

$Adatetime = $dateParts[2]."-".$dateParts[1]."-".$dateParts[0]." ".$timeParts[0].":".$timeParts[1].":00" ;

 

 

Link to comment
https://forums.phpfreaks.com/topic/120331-can-somebody-help-with-this-script/
Share on other sites

 

 

I tried adding the .$timeParts[2] but this didn't work either, does anybody know the correct formula for this to work?

 

$Adatetime = $dateParts[2]."-".$dateParts[1]."-".$dateParts[0]." ".$timeParts[0].":".$timeParts[1].":".$timeParts[2];

 

Your help would be much appreciated.

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.