Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6562967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:46:23+00:00 2026-05-25T13:46:23+00:00

I want to list for the user, all timezones with their native UTC/GMT offset,

  • 0

I want to list for the user, all timezones with their native UTC/GMT offset, regardless of DST

How can I do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:46:23+00:00Added an answer on May 25, 2026 at 1:46 pm

    I ‘ve come up with this function to do the job:

    function standard_tz_offset($timezone) {
        $now = new DateTime('now', $timezone);
        $year = $now->format('Y');
    
        $startOfYear = new DateTime('1/1/'.$year, $timezone);
        $startOfNext = new DateTime('1/1/'.($year + 1), $timezone);
    
        $transitions = $timezone->getTransitions($startOfYear->getTimestamp(),
                                                 $startOfNext->getTimestamp());
        foreach($transitions as $transition) {
            if(!$transition['isdst']) {
                return $transition['offset'];
            }
        }
    
        return false;
    }
    

    How it works

    The function accepts a timezone and creates two DateTime objects: January 1st 00:00 of the current year and January 1st 00:00 of the next year, both specified in that timezone.

    It then calculates the DST transitions during this year, and returns the offset for the first transition it finds where DST is not active.

    PHP 5.3 is required because of the call to DateTimeZone::getTransitions with three parameters. If you want this to work in earlier versions you will have to accept a performance hit, because a whole lot of transitions will be generated by PHP (in this case, you don’t need to bother with creating the $startOfYear and $startOfNext dates).

    I have also tested this with timezones that do not observe DST (e.g. Asia/Calcutta) and it works for those as well.

    To test it:

    $timezone = new DateTimeZone("Europe/Athens");
    echo standard_tz_offset($timezone);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to list all users with their corropsonding user class. Here are simplified
I want to sort list items by their priority, which the user types in,
Can someone help me list all Columns along with its Table of all User
I want to create a query to list of all user defined stored procedures,
I want list of user created databases in sql server 2005. How can list
I want to list messages that received specific user from other users group by
I want to fetch the user groups and want to list them but I
mySQL total user count Grouping by month I want to list the total count
I want to offer the user a list of urls that he/she has clicked
Using Rails 3.1.3 and Ruby 1.9.3. I want to give the user a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.