Join Kevin Skoglund for an in-depth discussion in this video Add a time zone Selection-Option, part of Easy PHP Projects: Time Zone Conversion.
- View Offline
- Exercise Files
- [Voiceover] Lets improve we created in the last movie…by adding a list of all time zones…as options under our forms select tag.…Specifically what I want to do is create…a dynamic list of these options where right now…I have a hard-coded one for America/New York.…I want to have a list of all the time zones…that available in PHP listed dynamically.…So lets think back, how do we get a list…of all the time zones that PHP has available?…We actually did exactly that…back in the beginning of chapter two.…
And if you open up the file tz_identifiers.php…you'll see the code where we demonstrated it.…We had timezone_identifiers_list…and that's the PHP function that returns…an array that lists out all those time zone identifiers.…There is also the object oriented version…DateTimeZone::listIdentifiers and you can use that as well.…Lets grab that. I'll grab both of them…so that we can see that they both work.…And I'm just going to move back over here to this file…and at the very top lets put some PHP tags.…
And there we go.…
- 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.