Join Kevin Skoglund for an in-depth discussion in this video Create date selectors, part of Easy PHP Projects: Time Zone Conversion.
- View Offline
- Exercise Files
- [Voiceover] In this movie, we will change our date input…from a simple text field to a series of select option tags.…We've already gone through the process of creating…select option tags when we were working with timezones.…We wrote this function called timezone_select_options.…Let's take a look at that.…You can see that this gathers together an array…and then it iterates through the array…generating each of those options.…That process is really the same any time we're working…with select options.…We want to do this same thing.…We want to output an option tag,…we want it to have a value,…we want to know whether that value…has the currently selected value,…and we want to output a label inside the option tag.…
So what I want to do is I want us to create…a generic function that will output…these select options for us, if we give it a good array.…In other words, we put together the array…that has key value pairs that make sense…so that it can use them for its value and for its label,…and then it just iterates through that array…
- 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?
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.