Join Kevin Skoglund for an in-depth discussion in this video Solution: Use major cities, part of Easy PHP Projects: Time Zone Conversion.
- View Offline
- Exercise Files
- [Voiceover] Hopefully you were able to…complete the challenge on your own.…Here is the solution I came up with.…The first thing that I did was I needed to…come up with a list of the cities that I wanted to use,…so I chose to use the 25 most populous cities…in the world, so I went to the internet and I found…a list of those 25 cities ranked in order by their size…and I got those together in an array.…So I have Tokyo, Japan, New York, USA,…Sao Paulo, Brazil, and so on, all the way down the line.…Then, once I have that in array,…I filled in the time zone for each one,…and that was by far and away the most time-consuming part…of this process, because I had to do research to look…and make sure I had the right time zone for each one.…
It's not something you can just do programatically.…You can't just search for Tokyo in order to find Tokyo…in the list of time zones that PHP supports,…because, when we get to Osaka,…Osaka doesn't show up in the list.…It is the Tokyo time zone, and that's true for many cities.…You can see for example in India, we have a number…
- Understanding the history and purpose of time zones
- Setting a default time zone in PHP
- Using the PHP DateTime and DateTimeZone classes
- Working with daylight saving time transitions
- Allowing users to select their time zone
- Displaying times in the user's preferred time zone
- Calculating the current times of major cities
- Creating a complete time zone calculator
Skill Level Beginner
1. About Time Zones
2. Default Time Zone
3. Working with Time Zones in PHP
4. User Time Zone Selection
5. Respect the User's Time Zone
6. Current World Times
7. Time Zone Calculator
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.