Easy PHP Projects: Time Zone Conversion
2h 54mBeginner2016-03-11
Authors

Kevin Skoglund
Founder of NovaFabrica
Course details
Follow along with Easy PHP Projects to practice your PHP skills while solving real-world programming challenges. This project focuses on converting dates and times between time zones using PHP's built-in functions. Kevin Skoglund explains the history and purpose of time zones, along with quirks like daylight saving time, and then shows how to design location-sensitive webpages and to build a PHP-driven time zone calculator. Each tutorial offers practical PHP techniques suitable for any developer, including PHP beginners..
Learning objectives
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
Learning objectives
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
Skills covered
PHPProgramming LanguagesOpen SourceSoftware DevelopmentOne-Off
Concepts
0. Introduction
- 01 - Welcome
- 02 - How to use the exercise files
1. About Time Zones
- 03 - History
- 04 - UTC and time zone offsets
- 05 - Daylight saving time (DST)
2. Default Time Zone
- 06 - PHP time zone identifiers
- 07 - Set default in php.ini
- 08 - Set default at runtime
3. Working with Time Zones in PHP
- 09 - Understanding Unix time
- 10 - PHP procedural functions
- 11 - PHP DateTime
- 12 - PHP DateTimeZone
- 13 - DST transitions
4. User Time Zone Selection
- 14 - Create the form
- 15 - Add a time zone Selection-Option
- 16 - Include the time zone offset
- 17 - Improve offset formatting
- 18 - Store the time zone selection
5. Respect the User's Time Zone
- 19 - Display the current time
- 20 - Convert to user's time zone
- 21 - Challenge - Create a maintenance page
- 22 - Solution - Create a maintenance page
- 23 - Store dates in a database
6. Current World Times
- 24 - List time zones
- 25 - Challenge - Use major cities
- 26 - Solution - Use major cities
- 27 - Sort cities by offset
- 28 - More efficient sorting
7. Time Zone Calculator
- 29 - Create the form
- 30 - Time zone options function
- 31 - Convert the time zone
- 32 - Create date selectors
- 33 - Create minute selector
- 34 - Create hour selector
- 35 - Process date and time selections
Conclusion
- 36 - Next steps