Join Kevin Skoglund for an in-depth discussion in this video Include the time zone offset, part of Easy PHP Projects: Time Zone Conversion.
- [Voiceover] In the previous movie we created…a select option that included all…time zones available in PHP.…In this movie, we're going to improve that list…by also showing the user the offset from UTC…for each of those time zones.…So if we go down and we look at the list…that we just created in the last movie,…we have each of our options here.…Now, I don't want to change the value.…The value we want to stay the exact PHP time zone value.…What I want to do is change what the user sees,…which is what is here.…
So in addition to seeing the zone information,…I would also like to append something…that has a space and then in parentheses…will put UTC/GMT space, and then we're gonna…put an offset value.…I'm gonna drop that in, I'll call it $offset.…So now what we just need to do is calculate this value.…Now, I've included GMT here with UTC.…We now are educated and we know…that UTC is GMT and it's just a little more precise…and has some international agreement behind it.…
Even though UTC has been around for a long time,…
- 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.