com presentations: SunshinePHP modifications to Date/Time talk.: slides/time/date-timezone.xml slides/time/intervals-2.xml slides/time/intervals.xml slides/time/period-2.xml slides/time/relative-month.xml slides/time/relative-month3.xml slides/time/timezone-object-1.xml time-sunshine14.xml
[email protected] (Derick Rethans)
| Newsgroups | php.pres |
|---|---|
| Message-ID | <[email protected]> |
Commit: 3e9ff56fa57bf2c0298067e3df1ea08db45dc4a7 Author: Derick Rethans <[email protected]> Tue, 4 Feb 2014 17:13:44 +0000 Parents: 6ea8144142f2b699b319eb3ac71c55c75cb2f93d Branches: master Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=3e9ff56fa57bf2c0298067e3df1ea08db45dc4a7 Log: SunshinePHP modifications to Date/Time talk. Changed paths: M slides/time/date-timezone.xml M slides/time/intervals-2.xml M slides/time/intervals.xml M slides/time/period-2.xml M slides/time/relative-month.xml M slides/time/relative-month3.xml M slides/time/timezone-object-1.xml A time-sunshine14.xml Diff: diff --git a/slides/time/date-timezone.xml b/slides/time/date-timezone.xml index a48a1fc..06173d9 100644 --- a/slides/time/date-timezone.xml +++ b/slides/time/date-timezone.xml @@ -7,13 +7,13 @@ $tz1 = new DateTimeZone("Pacific/Honolulu"); $tz2 = new DateTimeZone("Australia/Melbourne"); - $ts = new DateTime("1978-12-22 09:15", $tz1); + $ts = new DateTimeImmutable("1978-12-22 09:15", $tz1); echo $ts->getTimezone()->getName(), ': ', $ts->format(DateTime::RFC2822), "<br/>"; - $ts->setTimezone($tz2); + $melbourne = $ts->setTimezone($tz2); - echo $ts->getTimezone()->getName(), ': ', - $ts->format(DateTime::RFC2822), "<br/>"; + echo $melbourne->getTimezone()->getName(), ': ', + $melbourne->format(DateTime::RFC2822), "<br/>"; ?>]]></example> </slide> diff --git a/slides/time/intervals-2.xml b/slides/time/intervals-2.xml index 5fbe3b7..8cb07a9 100644 --- a/slides/time/intervals-2.xml +++ b/slides/time/intervals-2.xml @@ -4,7 +4,7 @@ <blurb>Applying an interval</blurb> <example result="0"><![CDATA[<?php -$d = new DateTime( 'Aug 28th, 2009' ); +$d = new DateTimeImmutable( 'Aug 28th, 2009' ); echo $d->format( "l Y-m-d\n" ); $i = DateInterval::createFromDateString( "next weekday" ); @@ -17,6 +17,6 @@ echo $d->sub( $i )->format( "l Y-m-d\n" ); <blurb>Result:</blurb> <blurb class='pre'> Friday 2009-08-28</blurb> <blurb effect="fade-in" class='pre'> Monday 2009-08-31</blurb> - <blurb effect="fade-in" class='pre'> Thursday 2009-05-21</blurb> + <blurb effect="fade-in" class='pre'> Thursday 2009-05-18</blurb> </slide> diff --git a/slides/time/intervals.xml b/slides/time/intervals.xml index 179aae0..3711820 100644 --- a/slides/time/intervals.xml +++ b/slides/time/intervals.xml @@ -11,8 +11,8 @@ $i = new DateInterval( 'P0003-01-15T06:12:30' ); $i = new DateInterval( 'P3DT6H' ); // from a difference -$d1 = new DateTime(); -$d2 = new DateTime( "2013-08-13 19:30 Europe/London" ); +$d1 = new DateTimeImmutable(); +$d2 = new DateTimeImmutable( "2013-08-13 19:30 Europe/London" ); $i = $d1->diff( $d2 ); // displaying the difference diff --git a/slides/time/period-2.xml b/slides/time/period-2.xml index 5df7ea0..a1bfb55 100644 --- a/slides/time/period-2.xml +++ b/slides/time/period-2.xml @@ -4,8 +4,8 @@ <subtitle>Iterating over a period</subtitle> <example result="1"><![CDATA[<?php -$db = new DateTime( '2008-12-31' ); -$de = new DateTime( '2009-12-31' ); +$db = new DateTimeImmutable( '2008-12-31' ); +$de = new DateTimeImmutable( '2009-12-31' ); $di = DateInterval::createFromDateString( 'third tuesday of next month' ); diff --git a/slides/time/relative-month.xml b/slides/time/relative-month.xml index 957b6a2..6b8657b 100644 --- a/slides/time/relative-month.xml +++ b/slides/time/relative-month.xml @@ -4,7 +4,7 @@ <subtitle>"previous month" / "next month"</subtitle> <example result="1"><![CDATA[<?php - $date = new DateTime( '2010-01-31 15:48:21' ); + $date = new DateTimeImmutable( '2010-01-31 15:48:21' ); echo $date->modify( 'next month' )->format( 'Y-m-d' ), "\n"; ?>]]></example> <break/> diff --git a/slides/time/relative-month3.xml b/slides/time/relative-month3.xml index 49c1c1c..2279b18 100644 --- a/slides/time/relative-month3.xml +++ b/slides/time/relative-month3.xml @@ -4,7 +4,7 @@ <subtitle>"first day *of* next month"</subtitle> <example result="1"><![CDATA[<?php - $date = new DateTime( '2010-01-31 15:48:21' ); + $date = new DateTimeImmutable( '2010-01-31 15:48:21' ); echo $date->modify( 'first day of next month' )->format( 'Y-m-d' ), "\n"; ?>]]></example> <break/> diff --git a/slides/time/timezone-object-1.xml b/slides/time/timezone-object-1.xml index 6576b41..5f996ef 100644 --- a/slides/time/timezone-object-1.xml +++ b/slides/time/timezone-object-1.xml @@ -10,13 +10,13 @@ <blurb>Using the timezone when parsing a string:</blurb> <example><![CDATA[<?php $tz = new DateTimeZone("Pacific/Honolulu"); - $ts = new DateTime("1978-12-22 09:15", $tz); + $ts = new DateTimeImmutable("1978-12-22 09:15", $tz); ?>]]></example> <blurb>A passed timezone does not override a *parsed* timezone:</blurb> <example result="1"><![CDATA[<?php $tz = new DateTimeZone("Pacific/Honolulu"); - $ts2 = new DateTime("1978-12-22 09:15 Europe/London", $tz); + $ts2 = new DateTimeImmutable("1978-12-22 09:15 Europe/London", $tz); echo $ts2->format( DateTime::RFC2822 ); ?>]]></example> </slide> diff --git a/time-sunshine14.xml b/time-sunshine14.xml new file mode 100644 index 0000000..5ba1ad0 --- /dev/null +++ b/time-sunshine14.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="utf-8"?> +<presentation css="10gen-strict.css"> +<topic>Localization and Internationalization</topic> +<title>Date/Time Handling</title> +<event>Sunshine PHP</event> +<location>Miama, FL, USA</location> +<date>Feb 8th, 2014</date> +<speaker>Derick Rethans</speaker> +<email>[email protected]</email> +<url>http://derickrethans.nl/talks.html</url> +<joindin>http://joind.in/10529</joindin> +<twitter>derickr</twitter> + +<slide>slides/mongodb/title.xml</slide> +<slide>slides/mongodb/me.xml</slide> + +<!-- INTRODUCTION --> +<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 --> +<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> + +<!-- EXIT --> +<slide>slides/time/book.xml</slide> <!-- resources --> +<slide>slides/mongodb/resources.xml</slide> <!-- resources --> +</presentation>