Windows OS - Setting time zone in testlink

Moderators: Amaradana, TurboPT, TL Developers

aostad
Member of TestLink Community
Posts: 183
Joined: Wed Apr 01, 2009 8:32 pm

Windows OS - Setting time zone in testlink

Post by aostad »

I have set the time in PHP.ini file but not sure if there is any configuration in Testlink too.
All test cases get wrong time stamps during creation or import/export.
Thanks.
TurboPT
Member of TestLink Community
Posts: 343
Joined: Sun Dec 10, 2006 4:51 am

Re: Windows OS - Setting time zone in testlink

Post by TurboPT »

No other date/time setting within TestLink that I know...

It is not clear what was changed in the php.ini file, but make sure this setting in php.ini is correct for your locale:

Code: Select all

date.timezone = 'America/New_York'
Make sure to restart the web service after making any changes to this file.

Also, make sure that the current system date/time is correct and not falling behind.
aostad
Member of TestLink Community
Posts: 183
Joined: Wed Apr 01, 2009 8:32 pm

Re: Windows OS - Setting time zone in testlink

Post by aostad »

I have it in the same format but used " ". I'll try ' '. Thanks for replying.
aostad
Member of TestLink Community
Posts: 183
Joined: Wed Apr 01, 2009 8:32 pm

Re: Setting time in testlink

Post by aostad »

Unfortunately, it doesn't work. I even configured
date.default_latitude
date.default_longitude

It looks like somehow the date and time get overwritten by some default settings. Date/time is correct in log file but is not right in testlink pages.

BTW, I'm using IIs7 (Not apache). Is it possible IIS doing something?
aostad
Member of TestLink Community
Posts: 183
Joined: Wed Apr 01, 2009 8:32 pm

Re: Windows OS - Setting time zone in testlink

Post by aostad »

BTW, When I set the date.timezone=America/Los_Angeles, the time in Test Specification page is 8 hours behind, while "Events" page shows right time.
TurboPT
Member of TestLink Community
Posts: 343
Joined: Sun Dec 10, 2006 4:51 am

Re:Windows OS - Setting time zone in testlink

Post by TurboPT »

aostad wrote:...BTW, I'm using IIs7 (Not apache). Is it possible IIS doing something?
I don't know much about IIs7, but see if this information, or this information might be helpful for you.
aostad
Member of TestLink Community
Posts: 183
Joined: Wed Apr 01, 2009 8:32 pm

Re: Windows OS - Setting time zone in testlink

Post by aostad »

Thanks for replying.
These information is about the format of date. The problem that I'm encountering is wrong calculation of time.For example, when I set date.timezone=America/Los_Angelese and curren time is 22:00:00, the time of created test case shows 14:00:00. That means testlink shows it 8 hours behind, while the time stamp for PHP logged messages is right.
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: Windows OS - Setting time zone in testlink

Post by fman »

Issue opened http://mantis.testlink.org/view.php?id=5512
http://www.teamst.org/forum/viewtopic.php?f=42&t=7213

more info that may be can help
http://www.sqlhacks.com/Dates/UTC-Dates
http://blog.mikecouturier.com/2009/12/t ... tml#tz_app
http://stackoverflow.com/questions/3467 ... nes-in-php

did some tests on Windows 7 with MSSQL 2008 express, issue is that MSSQL stores date/time using server TIMEZONE (I've read about this in internet) , then seems it always convert date/time we pass from PHP. <b> BAD/WRONG CONCLUSION, new tests provide other info</b>
One issue probably we will have when USING DEFAULTS on date/time columns is that if DBSERVER TIMEZONE is NOT ALIGNED with PHP time zone we are going
to have issues with date/time.

This behaviour is different to what MySQL do (at least if you use standard installation with XAMPP) where DB accept and use what is provided without doing any transformation.
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: Windows OS - Setting time zone in testlink

Post by fman »

Issue seems related to date formatted as strings returned from ADODB for MSSQL

MSSQL
["creation_ts"]=> string(20) "2013-02-02T08:27:44Z"
["modification_ts"]=> string(20) "2013-02-02T08:29:00Z"

MySQL
["creation_ts"]=> string(20) "2013-02-02 08:27:44" => No T, No Z
["modification_ts"]=> string(20) "2013-02-02 08:29:00"

when the function that localize dates (on lang_api.php) uses strtotime() the issue arise.

Solution (to be fully tested) will be remove T and Z from string
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: Windows OS - Setting time zone in testlink

Post by fman »

Here the same findings
http://www.deepshiftlabs.com/dev_blog/? ... lang=en-us

an excerpt

I want to draw your attention to the fact that the new Microsoft driver returns datetime as PHP DateTime:: object. But we use ADODB, which does this little trick converting this object into a string on line 794 of adodb-mssqlnative.inc.php file:
View Code PHP

$this->fields[$key] = $value->format("Y-m-d\TH:i:s\Z");

Thus, returning us the string ’2012-08-22T23:42:22Z ‘instead of the usual ’2012-08-22 23:42:22′ and so for backward compatibility, you can correct adodb-mssqlnative.inc.php this way:
View Code PHP

if(is_array($this->fields)) {
foreach($this->fields as $key=>$value) {
if (is_object($value) && method_exists($value, 'format')) {//is DateTime object
//$this->fields[$key] = $value->format("Y-m-d\TH:i:s\Z");
//DSL DateTime output format fix
$this->fields[$key] = $value->format("Y-m-d H:i:s");
}
}
}
aostad
Member of TestLink Community
Posts: 183
Joined: Wed Apr 01, 2009 8:32 pm

Re: Windows OS - Setting time zone in testlink

Post by aostad »

Thanks. I've tried it and it works.
aostad
Member of TestLink Community
Posts: 183
Joined: Wed Apr 01, 2009 8:32 pm

Re: Windows OS - Setting time zone in testlink

Post by aostad »

BTW,You may want to associate issue 0005339, which marked as resolved, to this problem.
abrjib0
TestLink user
Posts: 8
Joined: Thu Jan 31, 2013 7:42 pm

Re: Windows OS - Setting time zone in testlink

Post by abrjib0 »

Sorry guys, is there anyway I can fix it in my system as I am having this issue here.
I am in timezone (UTC+08:00) Perth. Installed TestLink using BitNami stack.
Sorry if it has been already explained .
New to TL and finding it GREAT! :-)
aostad
Member of TestLink Community
Posts: 183
Joined: Wed Apr 01, 2009 8:32 pm

Re: Windows OS - Setting time zone in testlink

Post by aostad »

As it's been said, in file "third_party\adodb\drivers\adodb-mssqlnative.inc.php"
replace this:
$this->fields[$key] = $value->format("Y-m-d\TH:i:s\Z");

with this:
$this->fields[$key] = $value->format("Y-m-d H:i:s");
Ferhan
TestLink user
Posts: 1
Joined: Sun Dec 24, 2017 6:51 pm

Re: Windows OS - Setting time zone in testlink

Post by Ferhan »

TurboPT wrote:No other date/time setting within TestLink that I know...

It is not clear what was changed in the php.ini file, but make sure this setting in php.ini is correct for your locale:

Code: Select all

date.timezone = 'America/New_York'
Make sure to restart the web service after making any changes to this file.

Also, make sure that the current system date/time is correct and not falling behind.
--------------
Where can I find PHP.ini file? I searched in Testlink folder but no luck.
Post Reply