I need to set the recordtime +7 hours for my form submissions since I'm in another timezone than my server. How do I do that?
Forums
Wrong timestamp in database
Hi, edit the Autogenerated code, there is a date( ) function used there, edit it to add +7 hours, you may use google quickly to look how to add some time difference to the "date()" function in PHP
Regards
Max
P.S: if you couldn't do it then please post back and I will look for this!
Regards
Max
P.S: if you couldn't do it then please post back and I will look for this!
Thank you for your quick answer, but I'm not so PHP savvy... I need help how to modify the code. Here is the first lines with date():
I've looked at this page: http://se2.php.net/date but I don't know how to make use of anything there...
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16);
$database->setQuery( "INSERT INTO #__chronoforms_3 VALUES (
'' , '".$inum."','". date('Y-m-d')." - ".date("H:i:s")."', '".$_SERVER['REMOTE_ADDR']."' , '".mosGetParam($_POST,'formfield1','')."' ,
I've looked at this page: http://se2.php.net/date but I don't know how to make use of anything there...
Hi, see this code from PHP site:
you can edit it alittle to add only estra 7 hours, let me know if you couldn't achieve it!๐
Regards
Max
$nextWeek = time() + (7 * 24 * 60 * 60); // 7 days; 24 hours; 60 mins; 60secs
echo 'Now: '. date('Y-m-d') ."\n";
echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n";// or using strtotime():
echo 'Next Week: '. date('Y-m-d', strtotime('+1 week')) ."\n";
you can edit it alittle to add only estra 7 hours, let me know if you couldn't achieve it!๐
Regards
Max
Ok, I changed tha date part of the code to this:
and time is now displayed correctly but I don't know if this works with the date? Will it show the right date when it's past midnight here but before midnight server time? I'll have to stay up late and check that tonight๐
". date('Y-m-d', strtotime('+7 hours'))." - ".date("H:i:s", strtotime('+7 hours'))."
and time is now displayed correctly but I don't know if this works with the date? Will it show the right date when it's past midnight here but before midnight server time? I'll have to stay up late and check that tonight๐
Hi ProEventMedia,
Yes it should to that correctly, the whole timestamp is set to 7 hours ahead/back!
Bob
Yes it should to that correctly, the whole timestamp is set to 7 hours ahead/back!
Bob
I agree with Bob, let us know after you test!
Max
Max
Nice, It works! Server time (in USA) was 2008-11-30 - 17:55:46 but my recorded local time (in Sweden) was 2008-12-01 - 00:55:46 = + 7 hours with different date!
PERFECT!๐ Thank you for all your help.
PERFECT!๐ Thank you for all your help.
Hi ProEventMedia,
Glad this worked for you. You may have some small problems though in the periods when Daylight Savings Time changes as the USA and Europe are out of sync for a few weeks in the spring and autumn. This probably isn't a practical problem but better to be aware of it.
Bob
Glad this worked for you. You may have some small problems though in the periods when Daylight Savings Time changes as the USA and Europe are out of sync for a few weeks in the spring and autumn. This probably isn't a practical problem but better to be aware of it.
Bob
Hi,
I've the same problem but I don't know where I can find the autogenerated code. Could you help me?
Thanks
Matt
I've the same problem but I don't know where I can find the autogenerated code. Could you help me?
Thanks
Matt
Hi, edit the Autogenerated code, there is a date( ) function used there, edit it to add +7 hours, you may use google quickly to look how to add some time difference to the "date()" function in PHP
This topic is locked and no more replies can be posted.