Home Get Global Timezones/Locations in Dropdown Select Menu

    Get Global Timezones/Locations in Dropdown Select Menu

    0

    Using PHP’s listidentifiers (part of the DateTimeZone class ), we can create a dropdown menu of all available global timezone identifiers. It’s handy for inclusion in forms if you’re after a general region rather than just country.

    The first function retrieves timezone values and returns an array:

    The second function retrieves the timezone array and manufactures the select menu.

    Usage is as follows:

    The results is as follows:

    Note: I’ve included raw HTML to show the list so timezone values may not be correct.

    Shortt URL for this post: http://shor.tt/2nIT