On Fri, Mar 18, 2011 at 10:40 PM, <[email protected]> wrote:
> When I am executing a php code like below:
>
> <?php
> $timestamp=mktime(0,0,0,3,1,2011);
> echo $timestamp;
> ?>
>
> on Linux and Windows system then there is always a difference of 19800 in
> output. The result shown on Linux system is always 19800 less than the
> value displayed on Windows system.
19800 is exactly 5.30 hours which is IST to GMT offset.
Your Linux box is reporting UTC timezone while Windows is showing
localtime. It is common for Linux to set hardware clock to UTC and
use timezone data to calculate local time. Windows systems set the
hardware clock itself to local time. Windows/Linux dual booting systems
also run into this issue.
Set the TZ environment correctly before you call mktime.
See the Errors/Exceptions section of the manual:
http://php.net/manual/en/function.mktime.php
- Raja
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc