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
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.

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.