Join Kevin Skoglund for an in-depth discussion in this video Understanding Unix time, part of Easy PHP Projects: Time Zone Conversion.
- [Voiceover] We've now learned what time zones are,…and we learned how to set a default time zone in PHP.…Now in this chapter, we're ready to learn how to use them…in our PHP code.…The first thing you need to know about working with dates…and times in PHP, is that PHP uses Unix time.…Unix time is the number of seconds…since January 1, 1970,…at midnight, UTC.…So for example, the number 1451606400…is the number of seconds from January 1, 1970…at midnight UTC,…until January 1, 2016 at midnight, UTC.…
So, dates are all represented by these numbers…that tell us the number of seconds since that time.…And PHP uses Unix time internally,…it's sometimes referred to as a "time stamp."…The easiest way to see it in action…is just open up a new PHP file,…and tell it to echo back the time function.…And that will provide you with the current Unix time,…or the current time stamp.…Unix time is really useful.…It makes calculations super easy.…For example, if we want to take a number of seconds,…and we want to add to it a day,…well then, we just take 60 for 60 seconds,…
- 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.