0

I'm Trying to find Timezone for a Country by Using Below Code.

    // FIND TIMEZONE CODE FROM COUNTRY CODE HERE
    // COUNTRY CODE SHOULD BE IN ISO2 FORMAT
    $country_code      =   'GR';
    $arr_new_timezone   =   DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $country_code);

Code is working absolutely fine on My local server (WAMP) but not on Live Server.

What is wrong with this? Couldn't find out much solution about this issue.

Let me know What I can do to over come with this.

Thanks in Advance.

hakre
  • 193,403
  • 52
  • 435
  • 836
pinaldesai
  • 1,835
  • 2
  • 13
  • 22
  • check php version you are using on your Live server – swapnesh May 08 '12 at 05:17
  • Version and above code sounds cool, what type of error/result you are getting? – swapnesh May 08 '12 at 05:25
  • Check this link- http://stackoverflow.com/questions/2136200/make-timezone-dropdown-list-populate-with-available-timezones-on-a-per-country-b , it says for 5.3 php version..chk comments – swapnesh May 08 '12 at 05:33
  • I'm doing exactly the same thing mentioned in given URL. Only thing is I'm passing country code (ISO2 Format) dynamically and What I'm getting is Fatal error: Undefined class constant 'PER_COUNTRY' in .... file line xxx . This code works fine for me on Local – pinaldesai May 08 '12 at 05:46
  • Cool u gotta working solution from the link :) cheers – swapnesh May 08 '12 at 05:54
  • nope.... My code and Link both works fine on my local server NOT on LIVE HOSTING SERVER. – pinaldesai May 08 '12 at 06:03

1 Answers1

2

The PHP version on your live server is not >= PHP 5.3

See here: http://www.php.net/manual/en/datetimezone.listidentifiers.php#refsect1-datetimezone.listidentifiers-changelog

Ja͢ck
  • 170,779
  • 38
  • 263
  • 309