<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
	<channel>
		<title>cotonti.com : DST Checking of Timestamps</title>
		<link>https://www.cotonti.com</link>
		<description>Son konu mesajları</description>
		<generator>Cotonti</generator>
		<language>en</language>
		<pubDate>Fri, 03 Apr 2026 21:15:53 -0000</pubDate>

		<item>
			<title>Hodges</title>
			<description><![CDATA[<p>Hi Macik, thanks for going to the trouble of researching this info. DateTimeZone() does appear to be the solution to my concerns.</p>
]]></description>
			<pubDate>Sal, 15 Nis 2014 09:36:47 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/tr/forums?m=posts&q=7722&d=0#post39452]]></link>
		</item>
		<item>
			<title>Macik</title>
			<description><![CDATA[<p>Thank you for a great question pushed me to read some docs. Here some info I get:</p>

<p>First of all — PHP already had tools to use timezines and DST.</p>

<p>Moreover, as DST is subject to change during long time periods (as legislation changes) PHP had these information in <code>DateTimeZone::listAbbreviations()</code>. </p>

<p>Than PHP used this info to properly convert time from one time zone to another.</p>

<p>So two rules should be used: <br />
1. store timestamps in UTC (as you do)<br />
2. use proper time zone for any convertion.</p>

<p>Let's try some example:</p>

<pre class="brush:php;">
$date = new DateTime('2000-01-01', new DateTimeZone('Europe/Moscow'));  
// DST is used in these period  (+03:00 winter +04:00 summer)
$plugin_body .= $date-&gt;format('Y-m-d H:i:s P') . PHP_EOL; // 2000-01-01 00:00:00+03:00
$date-&gt;setTimeZone(new DateTimeZone('UTC'));
$plugin_body .= $date-&gt;format('Y-m-d H:i:s P') . PHP_EOL; // 1999-12-31 21:00:00+00:00
$date-&gt;modify('+ 13 year'); 
// in midsummer of 2011 DST was canceled in our region
// actually we get in DST time forever (+04:00 winter +04:00 summer)
$plugin_body .= $date-&gt;format('Y-m-d H:i:s P') . PHP_EOL; // 2012-12-31 21:00:00+00:00
$date-&gt;setTimeZone(new DateTimeZone('Europe/Moscow')); 
$plugin_body .= $date-&gt;format('Y-m-d H:i:s P') . PHP_EOL; // 2013-01-01 01:00:00+04:00
// as DST is cancelled we +04:00 for whole year
</pre>

<p>So if user had selected propper timezone in users settings (user profile) DST should be concerned.</p>

<p>But some problem may occurs only if you use time shift functions (<code>$date-&gt;modify('+ 13 year');</code>) in local time zone as real calculation is made in UTC.</p>

<p>Some info links:</p>

<ul><li><a href="http://timezoneguide.com/dst.php" rel="nofollow">Actulat DST</a></li>
	<li><a href="http://stackoverflow.com/questions/19772999/php-daylight-savings-time-issue" rel="nofollow">DST on stackoverflow</a></li>
	<li><a href="http://www.php.net/manual/en/function.timezone-abbreviations-list.php" rel="nofollow">Timezone abbrevitions</a></li>
	<li><a href="https://wiki.php.net/rfc/datetime_and_daylight_saving_time" rel="nofollow">About DST and STD transitions</a></li>
</ul><p> </p>

<p> </p>
]]></description>
			<pubDate>Pzt, 14 Nis 2014 14:03:11 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/tr/forums?m=posts&q=7722&d=0#post39451]]></link>
		</item>
		<item>
			<title>Hodges</title>
			<description><![CDATA[<p>Hi,</p>

<p>I'm in the middle of working on a heavily modified calendar plugin that uses ajax to emulate google calendar. It's all going well but I want to pay special attention to how I present timestamps to users. At this stage I'd like to make it clear that I know it's important to store timestamps in UTC.</p>

<p><span style="line-height:1.6em;">Using cotonti's datetime functions, how do I take an historical timestamp and check if DST was in effect at the time (according to the user's timezone selection) and display the time accordingly? I want to ensure that, if DST is currently in effect for the user, I'm not applying DST corrections to a timestamp that refers to a time when DST wasn't in effect.</span></p>

<p>I hope my question makes sense... Thanks!</p>

<p>I've given examples below:</p>

<p>Create an event for a date outside DST when it is currently DST:</p>

<p>                STORE AS 09:00                 DISPLAY AS 09:00</p>

<p><span style="line-height:1.6em;">Create an event for a date outside DST when it is not currently DST:</span></p>

<p>                STORE AS 09:00                 DISPLAY AS 09:00</p>

<p><span style="line-height:1.6em;">Create an event for a date inside DST when it is currently DST:</span></p>

<p>                STORE AS 08:00                 DISPLAY AS 09:00</p>

<p><span style="line-height:1.6em;">Create an event for a date inside DST when it is not currently DST:</span></p>

<p>                STORE AS 08:00                 DISPLAY AS 09:00</p>
<p><strong>Added 22 minutes later:</strong></p><p>My example assumes I'm on the London/Europe timezone.</p>
<p><strong>Added 5 minutes later:</strong></p><p><strong>What would be ideal would be a function (and its reciprocal) that could take a UTC timestamp and the user's preferred timezone and output a local timestamp for the user ensuring it includes the DST correction appropriately based on whether the timestamp occurred during that timezone's DST rules.</strong></p>
]]></description>
			<pubDate>Pzt, 14 Nis 2014 11:37:33 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/tr/forums?m=posts&q=7722&d=0#post39450]]></link>
		</item>
	</channel>
</rss>