Join Kevin Skoglund for an in-depth discussion in this video PHP DateTimeZone, part of Easy PHP Projects: Time Zone Conversion.
- [Voiceover] In this movie, we'll learn how to use…the PHP DateTimeZone class.…DateTimeZone is a PHP class,…and you use it in an object-oriented style,…like we did with DateTime.…You call new followed by the class name…to create a new DateTimeZone instance.…The argument that you need to provide…is one of the time zone identifiers we discussed earlier.…You can in the first line that I'm instantiating…a new object using the time zone identifier for…America/New_York and assigning that to the variable TZ.…
Then I can call the get name function…on that DateTimeZone object and it will output the name…of the time zone.…Next, I call the function getLocation,…which returns an array of location information.…We'll see what's inside that array…when we demo this code in a moment.…And last, I wanted to remind you that the DateTimeZone class…contains the list of time zone identifiers.…We saw this previously when I mentioned that…it was an alternative to the procedural…time zone identifiers list function that we put in our…TZ identifiers .php script.…
- 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.