Join Kevin Skoglund for an in-depth discussion in this video Store the time zone selection, part of Easy PHP Projects: Time Zone Conversion.
- [Voiceover] Now that we have a good select option…on our form, we're ready to write the code…to process the form value.…In real life, you'd probably wanna store this value…with the user's data in a database…so that it can stick around.…But rather than go to the processes setting up a database…for this small project, we're gonna use something simpler.…We're gonna use PHP's session to store the value.…That allow us to be able to set it and retrieve it.…And to simulate what it would be like…if we have a full database.…The way that we use sessions in PHP is…we first have to tell PHP to start the sessions.…
And we do that with session_start.…That function will tell PHP…to make sessions available to us.…After that, we can call the sessions super global…to access the sessions.…Dollar sign, underscore, all capital Session…and then in square brackets, the string that identifies…the value that we either want to set or retrieve.…It's called the session key.…I'm gonna be using user_tz_ident…to store the user's timezone identifier.…
- 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.