1 Replies - 7054 Views - Last Post: 11 January 2009 - 11:40 PM Rate Topic: -----

#1 dhanyamohan   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 30-December 08

how to get time zone?

Post icon  Posted 11 January 2009 - 11:12 PM

When i try to execute the script
<?php
echo (date_default_timezone_get());
?>
I got the following error
Fatal error: Call to undefined function date_default_timezone_get() in c:\wamp\www\test\time.php on line 9
How to resolve this problem?
Is This A Good Question/Topic? 0
  • +

Replies To: how to get time zone?

#2 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5315
  • View blog
  • Posts: 14,184
  • Joined: 18-April 07

Re: how to get time zone?

Posted 11 January 2009 - 11:40 PM

date_default_timezone_get is only available if you are running PHP 5.2.0 or greater.

For getting the time zone, check out the "O" and "T" format specifiers of the date() function. "O" will give you the Difference to Greenwich time (GMT) in hours (your time zone offset) and "T" will give you the time zone abbreviation like "EST" for Eastern Standard Time.

There are a few other format specifiers you can use in date() for other things about timezone.

Hope that helped.

"At DIC we be timezone code ninjas... we move with time across the globe so that we can always live in eternal darkness" :snap:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1