Join Kevin Skoglund for an in-depth discussion in this video Display the current time, part of Easy PHP Projects: Time Zone Conversion.
- [Voiceover] in this chapter…we're going to start a new project.…But one which is very much based…on the work that we did in the previous chapter.…Once a user has selected a time zone preference…like we did in the last chapter, then we'll need…to write code which respects that preference.…We're gonna begin that process by simply…displaying the current time in the user's time zone.…I've created a new directory for this project…called time zone underscore sensitivity,…because we're gonna be sensitive…to what the user has previously selected.…
And there's two files in there, Index.PHP and Styles.CSS.…If we take a look in TextMate in the project view,…we can see both of those files side by side,…and Index.PHP is a very simple HTML page.…We still have that link to our styles,…so we pull in our style sheet,…I have a div with ID main content,…and an h1 called time zone sensitivity,…and then a div that just displays the current time,…it says current time, and then it has a span here…called time, and that's where we're gonna drop in…
- 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.