My PHP timezone is 'Asia/Tehran' so I would not expect gmmktime give me the same result as mktime.
php info:
Default timezone Asia/Tehran
However when I type in my php console:
echo date('jS F Y h:i:s A (T)', mktime());
3rd September 2013 11:23:10 AM (IRDT)
echo date('jS F Y h:i:s A (T)', gmmktime());
3rd September 2013 11:23:16 AM (IRDT)
While I expect 3.5 or 4.5 hours time difference. Am I making a mistake somewhere?
you need to give Argumente inside of gmmktime(). Your mistake is, understand first
mktime() vs gmmktime()
. see this link.And The workaround is simple, use gmdate() function to display dates created with
gmmktime()
.