tags:

views:

36

answers:

2

My friend is echoing the date using date(G:i:s) but the result getting displayed is neither the current system time nor the xampp server time (as he is using xampp).

so what is the possible reason for this problem and the solution to this problem.

Thanks in advance

A: 

date('G:i:s') ?

I thought so too, but php should spit out a parse error, not an arbitrary date.
banzaimonkey
PHP assumes unrecognised tokens are strings in many cases. It's a legacy "feature" :)
Brenton Alker
A: 

According to http://www.php.net/manual/en/function.date-default-timezone-get.php, the function

date_default_timezone_get()

will return the currently configured timezone of the running script. If no timezone was set via either a runtime option or PHP INI file, it will return the UTC timezone. This will let you figure out what is going on.

To set the timezone to what you want, use

date_default_timezone_set()

Link: http://www.php.net/manual/en/function.date-default-timezone-set.php

Michael Butler