Why the displayed time is incorrect?

The release related discussions, plans and questions.
Locked
reec
TestLink user
Posts: 3
Joined: Sun Jan 06, 2008 10:36 am

Why the displayed time is incorrect?

Post by reec »

First, TestLink is a fantastic job! I'm very happy to see some convinient modifications from 1.6.3 to 1.7.0.

However, one thing confused me. The time displayed on Testlink is not corresponding to my local time... I'm in China and the time displayed is 8 hours earlier my local time, no matter what locale I set in personal profile. Can anyone help me fix this out?

Thanks!~~
reec
TestLink user
Posts: 3
Joined: Sun Jan 06, 2008 10:36 am

Post by reec »

I see the source code, and I doubt it's ADOdb's problem.

Following is the flow to get the date in Testlink
(1) Testlink has a class 'database' in 'lib/functions/database.class.php' and the function db_now() will return current date.
(2) Inside db_now(), it will use ADOdb to get the date, like: $this->db->DBTimeStamp(time()).
(3) Inside DBTimeStamp(), it call adodb_date() to convert timestamp into formatted date. Problem raises here:
(a) If timestamp is 1199625728, the formatted date by adodb_date() is '2008-01-06 13:22:08';
(b) However, I try to use php function date() to do this convertion, the result is '2008-01-06 21:22:08'.....which is what I really want!!

Who can help me fix this??? One ugly solution is to modified db_now(), add 8 hours to the timestamp before passing to DBTimeStamp...
reec
TestLink user
Posts: 3
Joined: Sun Jan 06, 2008 10:36 am

Post by reec »

I has fix this out! ADOdb is ok.... Just because I didn't indicate the timezone. :shock:

### php.ini (especially the one for apache)

[Date]
; Defines the default timezone used by the date functions
date.timezone = PRC
Locked