tag:help.appveyor.com,2012-11-13:/discussions/problems/2391-setting-build-worker-time-zoneAppVeyor: Discussion 2018-10-19T08:17:17Ztag:help.appveyor.com,2012-11-13:Comment/372526632015-06-30T02:31:58Z2015-06-30T02:31:58ZSetting build worker Time Zone<div><p>Well, this worked before: <a href="http://help.appveyor.com/discussions/questions/892-change-timezone-of-build-machine">
http://help.appveyor.com/discussions/questions/892-change-timezone-...</a></p>
<p>Try maybe calling it as "cmd", not "ps".</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/372526632015-06-30T04:05:06Z2015-06-30T04:05:06ZSetting build worker Time Zone<div><p>I do pretty much the same thing -<br>
here is part of my YML file:</p>
<p>init:<br>
- cmd: tzutil /s "Mountain Standard Time" - ps:
$env:TimestampBuildVersion =
(Get-Date).ToString('yy.M.d.HHmm');</p>
<p>it still did not work for me.</p></div>lukasz.stanczyktag:help.appveyor.com,2012-11-13:Comment/372526632015-06-30T04:17:04Z2015-06-30T04:17:04ZSetting build worker Time Zone<div><p>I've played with that a little bit. Seems like PowerShell stores
time zone in the session.</p>
<p>For example this works:</p>
<pre>
<code>- time /t
- tzutil /s "Mountain Standard Time"
- time /t</code>
</pre>
<p>If you restart PowerShell console <code>Get-Date</code> works
too.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/372526632015-06-30T04:21:02Z2015-06-30T04:21:02ZSetting build worker Time Zone<div><p>Found this: <a href="http://stackoverflow.com/questions/29161929/powershell-showing-old-time-after-changing-the-time-zone">
http://stackoverflow.com/questions/29161929/powershell-showing-old-...</a></p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/372526632015-06-30T04:38:05Z2015-06-30T04:38:05ZSetting build worker Time Zone<div><p>OK so in this case is the Init script and build script in the
same powershell session?</p></div>lukasz.stanczyktag:help.appveyor.com,2012-11-13:Comment/372526632015-06-30T04:47:17Z2015-06-30T04:47:17ZSetting build worker Time Zone<div><p>Yep. Everything is one PowerShell session.</p>
<p>If everything you need is getting current date time in some
local zone you can do just:</p>
<pre>
<code>- ps: $env:TimestampBuildVersion = [TimeZoneInfo]::ConvertTimeBySystemTimeZoneId([DateTime]::UtcNow, "Mountain Standard Time").ToString('yy.M.d.HHmm')</code>
</pre></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/372526632015-06-30T18:03:26Z2015-06-30T18:03:26ZSetting build worker Time Zone<div><p>That is the workaround I used. Thank you.</p>
<p>best regards,<br>
<em>Lukasz Stanczyk</em> <em>CTO, co-owner</em></p>
<p>email: <a href="mailto:lukasz.stanczyk@pixelpines.com">lukasz.stanczyk@pixelpines.com</a><br>
office: +1 (605) 721-9893<br>
cell: +1 (605) 269-1177</p>
<ul>
<li>PIXEL PINES*, LLC 625 1/2 Main Street, Suite #2<br>
Rapid City, SD 57701</li>
</ul></div>lukasz.stanczyk