Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Longhorn PHP date/time talk, now with Quiz
- Loading branch information
Showing
17 changed files
with
182 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1"?> | ||
<slide> | ||
<title>Default Timezones</title> | ||
<title>Default Timezones</title> | ||
|
||
<blurb>Setting a default timezone:</blurb> | ||
<example result="0"><![CDATA[<?php | ||
date_default_timezone_set("Europe/Oslo"); | ||
$ts = new DateTime("1978-12-22 09:15"); | ||
echo $ts->format("e"); | ||
<blurb>Setting a default timezone:</blurb> | ||
<example result="0"><![CDATA[<?php | ||
date_default_timezone_set("Europe/Oslo"); | ||
$ts = new DateTime("1978-12-22 09:15"); | ||
echo $ts->format("e"); | ||
?>]]></example> | ||
<break/> | ||
|
||
<blurb>Getting a default timezone:</blurb> | ||
<example result="0"><![CDATA[<?php | ||
$default_identifier = date_default_timezone_get(); | ||
echo $default_identifier; | ||
<blurb>Getting a default timezone:</blurb> | ||
<example result="0"><![CDATA[<?php | ||
$default_identifier = date_default_timezone_get(); | ||
echo $default_identifier; | ||
?>]]></example> | ||
<break/> | ||
|
||
<blurb>Default timezone is 'guessed' in the following order:</blurb> | ||
<list> | ||
<bullet>~date_default_timezone_set()~ value</bullet> | ||
<bullet>php.ini's %date.timezone% setting</bullet> | ||
</list> | ||
<blurb>Default timezone is 'guessed' in the following order:</blurb> | ||
<list> | ||
<bullet>~date_default_timezone_set()~ value</bullet> | ||
<bullet>php.ini's %date.timezone% setting</bullet> | ||
</list> | ||
</slide> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
<slide> | ||
<title>Storing date/time in a database</title> | ||
<subtitle>Conclusion</subtitle> | ||
|
||
<blurb>If you want to future proof a specific date and time (Oct 1st, | ||
13:00)-ie, storing a time in *local time*:</blurb> | ||
<example><![CDATA[{ | ||
'title' : 'Giving a talk: Advanced Date/Time handling with PHP', | ||
'time' : { | ||
'tz': 'America/Montreal', | ||
'dt': '2012-10-01 13:00', | ||
} | ||
}]]></example> | ||
<break /> | ||
<subtitle>Summary</subtitle> | ||
|
||
<blurb>If you want to store a time for an appointment for a group of people | ||
all in different timezones-ie, store a *specific point in time*:</blurb> | ||
<example><![CDATA[{ | ||
'title' : 'Meeting about getting rid of Daylight Saving Time', | ||
'time' : { | ||
'tz': 'America/Montreal', | ||
'ts': 1349110800, | ||
'ts': ISODate("2018-04-19 15:27:32"), | ||
'tz': 'Europe/London', | ||
}, | ||
'attendees' : [ 'Arthur David Olson', 'Paul Eggert' ], | ||
}]]></example> | ||
<break /> | ||
|
||
<blurb>If you want to future proof a specific date and time (Oct 1st, | ||
13:00)-ie, storing a time in *local time*:</blurb> | ||
<example><![CDATA[{ | ||
'title' : 'Giving a talk: Advanced Date/Time handling with PHP', | ||
'time' : { | ||
'dt': '2018-04-18 19:40', | ||
'tz': 'Europe/London', | ||
} | ||
}]]></example> | ||
</slide> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<slide> | ||
<title>Storing date/time in a database</title> | ||
<subtitle>Query in MongoDB</subtitle> | ||
|
||
<example><![CDATA[{ | ||
'title' : 'Giving a talk: Advanced Date/Time handling with PHP', | ||
'time' : { | ||
'ts': ISODate("2018-04-19 15:27:32"), // ms since Epoch | ||
'tz': 'Europe/London', | ||
} | ||
}]]></example> | ||
|
||
<blurb>Query:</blurb> | ||
<example><![CDATA[ | ||
db.dates.aggregate( { '$project' : { | ||
local_date: { | ||
'$dateToString' : { | ||
format: '%Y-%m-%d %H:%M:%S', | ||
date: '$time.ts', | ||
timezone: '$time.tz' | ||
} | ||
} | ||
} } ); | ||
]]></example> | ||
|
||
<blurb>Result:</blurb> | ||
<example><![CDATA[{ | ||
"_id" : ObjectId("5ad8a9148cb588e5ea33f228"), | ||
"local_date" : "2018-04-19 16:34:57" | ||
}]]></example> | ||
</slide> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<slide> | ||
<title>Quiz Time!</title> | ||
|
||
<break lines="4"/> | ||
|
||
<div effect="fade-in-out"><blurb class="big-centre">each day has *24 hours*</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">each day is *23, 24 or 25 hours*</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">every time exists *only once* during a day</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">Februari has *29 or 30* days</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">every year is *365* days</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">every year is *365 or 366* days</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">everybody understands what *PI day* is</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">everybody understands what *4/20 means*</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">timezones are *whole hour* offsets from UTC</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">timezones are *half hour* offsets from UTC</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">jump *to DST* is around March</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">the difference between standard and DST is *an hour*</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">DST is always *ahead* of standard time</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">each country has *one* timezone</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">China spans *5 geographical* timezones</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">DST rules stay always the *same*</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">DST rules are announced *at least a year* in advance</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">DST rules are announced *in advance*</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">PST is *Pacific Standard Time*</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">a timezone identifier is the capital of a region</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">date calculations are easy</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">"2018-03-31" plus month is "2018-04-31"</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">"2018-03-31" plus month is "2018-04-30"</blurb></div> | ||
<div effect="fade-in-out"><blurb class="big-centre">every date calculation is reversable</blurb></div> | ||
</slide> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<presentation css="10gen-strict.css"> | ||
<topic>Localization and Internationalization</topic> | ||
<title>Time Zones and Calendars are a PITA</title> | ||
<event>Longhorn PHP</event> | ||
<location>Austain, TX, US</location> | ||
<date>April 21st, 2018</date> | ||
<speaker>Derick Rethans</speaker> | ||
<email>derick@php.net</email> | ||
<url>http://derickrethans.nl/talks.html</url> | ||
<joindin>http://joind.in/23637</joindin> | ||
<twitter>derickr</twitter> | ||
|
||
<slide>slides/mongodb/title.xml</slide> | ||
<slide>slides/mongodb/me.xml</slide> | ||
|
||
<!-- INTRODUCTION --> | ||
<slide>slides/time/quiz.xml</slide> | ||
<slide>slides/time/problems-condensed.xml</slide> | ||
|
||
<!-- PHP - IMPROVEMENTS --> | ||
<slide>slides/time/improvements-timezones.xml</slide> | ||
<slide>slides/time/improvements-more-on-timezones.xml</slide> | ||
<slide>slides/time/default-timezone.xml</slide> | ||
<slide>slides/time/timestamps-suck.xml</slide> | ||
|
||
<!-- PHP - CODE EXAMPLES --> | ||
<slide>slides/time/basic-parse-time-new.xml</slide> | ||
<slide>slides/time/date-parse2.xml</slide> | ||
<slide>slides/time/date-parse-from-format3.xml</slide> | ||
<slide>slides/time/date-parse-from-format2.xml</slide> | ||
|
||
<!-- DATE EXAMPLES --> | ||
<slide>slides/time/date-modify.xml</slide> | ||
<slide>slides/time/date-modify-immutable1.xml</slide> | ||
<slide>slides/time/date-modify-immutable2.xml</slide> | ||
<slide>slides/time/timezone-object-1.xml</slide> | ||
<slide>slides/time/date-timezone.xml</slide> | ||
<slide>slides/time/timezone-utilities-3.xml</slide> | ||
|
||
<!-- INTERVALS and PERIODS --> | ||
<slide>slides/time/intervals.xml</slide> | ||
<slide>slides/time/intervals-2.xml</slide> | ||
<slide>slides/time/relative-month.xml</slide> | ||
<slide>slides/time/relative-month3.xml</slide> | ||
<slide>slides/time/period-2.xml</slide> | ||
|
||
<!-- STORING in DATABASE --> | ||
<!-- OLD: | ||
<slide>slides/time/in-database1.xml</slide> | ||
<slide>slides/time/in-database2.xml</slide> | ||
<slide>slides/time/in-database3.xml</slide> | ||
--> | ||
<slide>slides/time/in-database4.xml</slide> | ||
<slide>slides/time/in-mdb1.xml</slide> | ||
|
||
<!-- CALENDARS --> | ||
|
||
<!-- EXIT --> | ||
<slide>slides/time/book.xml</slide> <!-- resources --> | ||
<slide>slides/mongodb/questions.xml</slide> | ||
<slide>slides/mongodb/resources.xml</slide> <!-- resources --> | ||
</presentation> |