theJay Posted November 4, 2008 Share Posted November 4, 2008 Hopefully somebody can help me with this little bit of code, it's been awhile since I wrote php so I’m rusty and things have changed; I am coding this for PHP 5.2x to take advantage of the new date/time/dst functions. Right now I have UTC timezone offsets in minutes "-660" through "840" stored in a database, and I want to display them as "-11:00" through "+14:00"; with leading zeros on single digit hours “-270” would show "-04:30". I want to do this with the least amount of code possible, using optimal functions; it took me too many lines of code and I know it can be done much better with less code. Also, is there an existing database or function with the PHP timezones (http://us3.php.net/manual/en/timezones.php) to get the actual countries they belong to (php groups them in a very user unfriendly geographic way); there is almost 500 and I would hate to do the country codes manually; if you know any tricks to do this let me know and save me some major time. To see what I am attempting to do with country/timezones drop-down list, login to google and go here: https://www.google.com/accounts/EditUserInfo (select country, uncheck display all countries). Thanks for the help, hopefully down the road when I shake off the rust I can return the favor. Link to comment https://forums.phpfreaks.com/topic/131361-help-me-convertformat-utc-offset-to-hours-270-0430/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.