<div dir="ltr">Had a look at copying the source, it's changed a lot so I'm not able to to just use the unit (Namespaces, OS/X, Android, iOS support, changes to the way IFDEF work and so on). Going through the source I couldn't see any differences in the code itself, but I might have another pass at it.</div>
<div class="gmail_extra"><br clear="all"><div><pre cols="72">Alister Christie
Computers for People
Ph: 04 471 1849 Fax: 04 471 1266
<a href="http://www.salespartner.co.nz" target="_blank">http://www.salespartner.co.nz</a>
Follow us on Twitter <a href="http://twitter.com/salespartner" target="_blank">http://twitter.com/salespartner</a>
PO Box 13085
Johnsonville
Wellington</pre></div>
<br><br><div class="gmail_quote">On Thu, Apr 3, 2014 at 11:49 AM, Robo <span dir="ltr"><<a href="mailto:robo555@gmail.com" target="_blank">robo555@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div>NZ changed the day light saving week a few years ago, hence the incorrect calculation on older version of Delphi. Easiest way would probably be to copy XE5's source code.<br><br></div>Robo<br></div>
<div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Thu, Apr 3, 2014 at 12:30 AM, Alister Christie <span dir="ltr"><<a href="mailto:alister@salespartner.co.nz" target="_blank">alister@salespartner.co.nz</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">I've noticed in Delphi XE that TTimeZone.Local.ToUniversalTime is a week out on daylight savings, it works correctly in XE5 however (and probably earlier versions).<div>
<br></div><div><div><span style="font-size:13px;font-family:'Courier New';font-weight:bold">program</span><span style="font-size:13px;font-family:'Courier New'"> </span><span style="font-size:13px;font-family:'Courier New'">Project6</span><span style="font-size:13px;font-family:'Courier New'">;</span><span style="font-size:13px;font-family:'Courier New'"> </span><br style="font-size:13px;font-family:'Courier New'">
<br style="font-size:13px;font-family:'Courier New'"><span style="font-family:'Courier New';font-size:13px;color:rgb(0,128,0)">{$APPTYPE CONSOLE}</span><span style="font-size:13px;font-family:'Courier New'"> </span><br style="font-size:13px;font-family:'Courier New'">
<br style="font-size:13px;font-family:'Courier New'"><span style="font-size:13px;font-family:'Courier New';font-weight:bold">uses</span><span style="font-size:13px;font-family:'Courier New'"> </span><br style="font-size:13px;font-family:'Courier New'">
<span style="font-size:13px;font-family:'Courier New'"> </span><span style="font-size:13px;font-family:'Courier New'">SysUtils</span><span style="font-size:13px;font-family:'Courier New'">,</span><span style="font-size:13px;font-family:'Courier New'"> </span><br style="font-size:13px;font-family:'Courier New'">
<span style="font-size:13px;font-family:'Courier New'"> </span><span style="font-size:13px;font-family:'Courier New'">DateUtils</span><span style="font-size:13px;font-family:'Courier New'">;</span><span style="font-size:13px;font-family:'Courier New'"> </span><br style="font-size:13px;font-family:'Courier New'">
<br style="font-size:13px;font-family:'Courier New'"><span style="font-size:13px;font-family:'Courier New';font-weight:bold">begin</span><span style="font-size:13px;font-family:'Courier New'"> </span><br style="font-size:13px;font-family:'Courier New'">
<span style="font-size:13px;font-family:'Courier New'"> </span><span style="font-size:13px;font-family:'Courier New'">Writeln</span><span style="font-size:13px;font-family:'Courier New'">(</span><span style="font-size:13px;font-family:'Courier New'">DateTimeToStr</span><span style="font-size:13px;font-family:'Courier New'">(</span><span style="font-size:13px;font-family:'Courier New'">TTimeZone</span><span style="font-size:13px;font-family:'Courier New'">.</span><span style="font-size:13px;font-family:'Courier New'">Local</span><span style="font-size:13px;font-family:'Courier New'">.</span><span style="font-size:13px;font-family:'Courier New'">ToUniversalTime</span><span style="font-size:13px;font-family:'Courier New'">(</span><span style="font-size:13px;font-family:'Courier New'">StrToDateTime</span><span style="font-size:13px;font-family:'Courier New'">(</span><span style="font-family:'Courier New';font-size:13px;color:rgb(0,0,255)">'5/4/2014 2pm'</span><span style="font-size:13px;font-family:'Courier New'">))));</span><span style="font-size:13px;font-family:'Courier New'"> </span><br style="font-size:13px;font-family:'Courier New'">
<span style="font-size:13px;font-family:'Courier New'"> </span><span style="font-size:13px;font-family:'Courier New'">Writeln</span><span style="font-size:13px;font-family:'Courier New'">(</span><span style="font-size:13px;font-family:'Courier New'">DateTimeToStr</span><span style="font-size:13px;font-family:'Courier New'">(</span><span style="font-size:13px;font-family:'Courier New'">TTimeZone</span><span style="font-size:13px;font-family:'Courier New'">.</span><span style="font-size:13px;font-family:'Courier New'">Local</span><span style="font-size:13px;font-family:'Courier New'">.</span><span style="font-size:13px;font-family:'Courier New'">ToUniversalTime</span><span style="font-size:13px;font-family:'Courier New'">(</span><span style="font-size:13px;font-family:'Courier New'">StrToDateTime</span><span style="font-size:13px;font-family:'Courier New'">(</span><span style="font-family:'Courier New';font-size:13px;color:rgb(0,0,255)">'12/4/2014 2pm'</span><span style="font-size:13px;font-family:'Courier New'">))));</span><span style="font-size:13px;font-family:'Courier New'"> </span><br style="font-size:13px;font-family:'Courier New'">
<span style="font-size:13px;font-family:'Courier New'"> </span><span style="font-size:13px;font-family:'Courier New'">Readln</span><span style="font-size:13px;font-family:'Courier New'">;</span><span style="font-size:13px;font-family:'Courier New'"> </span><br style="font-size:13px;font-family:'Courier New'">
<span style="font-size:13px;font-family:'Courier New';font-weight:bold">end</span><span style="font-size:13px;font-family:'Courier New'">.</span><span style="font-size:13px;font-family:'Courier New'"> </span><br>
</div><div><font face="courier new, monospace"><br></font></div><div><br></div><div>Outputs</div><div><br>
</div><div><div><font face="courier new, monospace">5/04/2014 1:00:00 a.m.</font></div><div><font face="courier new, monospace">6/04/2014 1:00:00 a.m.</font></div></div><div><br></div><div>in XE (incorrectly) and </div><div>
<br></div><div><div><font face="courier new, monospace">5/04/2014 1:00:00 a.m.</font></div><div><font face="courier new, monospace">6/04/2014 2:00:00 a.m.</font></div></div><div><br></div><div>in XE5 (correctly). XE works correctly from the 13th onwards - so it's just a problem for a week.</div>
<div><br></div><div>Does anyone have some code that does conversions to UTC correctly for Delphi XE?</div><span><font color="#888888"><div><br></div><div><pre cols="72">Alister Christie
Computers for People
Ph: 04 471 1849 Fax: 04 471 1266
<a href="http://www.salespartner.co.nz" target="_blank">http://www.salespartner.co.nz</a>
Follow us on Twitter <a href="http://twitter.com/salespartner" target="_blank">http://twitter.com/salespartner</a>
PO Box 13085
Johnsonville
Wellington</pre></div>
</font></span></div></div>
<br></div></div>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz" target="_blank">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz" target="_blank">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br></blockquote></div><br></div>
<br>_______________________________________________<br>
NZ Borland Developers Group - Delphi mailing list<br>
Post: <a href="mailto:delphi@listserver.123.net.nz">delphi@listserver.123.net.nz</a><br>
Admin: <a href="http://delphi.org.nz/mailman/listinfo/delphi" target="_blank">http://delphi.org.nz/mailman/listinfo/delphi</a><br>
Unsubscribe: send an email to <a href="mailto:delphi-request@listserver.123.net.nz">delphi-request@listserver.123.net.nz</a> with Subject: unsubscribe<br></blockquote></div><br></div>