Setting build worker Time Zone

lukasz.stanczyk's Avatar

lukasz.stanczyk

29 Jun, 2015 09:44 PM

Hi.
In my build script I rely on time stamps and would like to change the time zone of the build worker.
In the init script I added

tzutil /s "Mountain Standard Time"
$env:TimestampBuildVersion = (Get-Date).ToString('yy.M.d.HHmm');

but it seemed to have no effect. Am I doing something wrong?

  1. Support Staff 1 Posted by Feodor Fitsner on 30 Jun, 2015 02:31 AM

    Feodor Fitsner's Avatar

    Well, this worked before: http://help.appveyor.com/discussions/questions/892-change-timezone-...

    Try maybe calling it as "cmd", not "ps".

  2. 2 Posted by lukasz.stanczyk on 30 Jun, 2015 04:05 AM

    lukasz.stanczyk's Avatar

    I do pretty much the same thing -
    here is part of my YML file:

    init:
    - cmd: tzutil /s "Mountain Standard Time"
    - ps: $env:TimestampBuildVersion = (Get-Date).ToString('yy.M.d.HHmm');

    it still did not work for me.

  3. Support Staff 3 Posted by Feodor Fitsner on 30 Jun, 2015 04:17 AM

    Feodor Fitsner's Avatar

    I've played with that a little bit. Seems like PowerShell stores time zone in the session.

    For example this works:

    - time /t
    - tzutil /s "Mountain Standard Time"
    - time /t
    

    If you restart PowerShell console Get-Date works too.

  4. Support Staff 4 Posted by Feodor Fitsner on 30 Jun, 2015 04:21 AM

    Feodor Fitsner's Avatar
  5. 5 Posted by lukasz.stanczyk on 30 Jun, 2015 04:38 AM

    lukasz.stanczyk's Avatar

    OK so in this case is the Init script and build script in the same powershell session?

  6. Support Staff 6 Posted by Feodor Fitsner on 30 Jun, 2015 04:47 AM

    Feodor Fitsner's Avatar

    Yep. Everything is one PowerShell session.

    If everything you need is getting current date time in some local zone you can do just:

    - ps: $env:TimestampBuildVersion = [TimeZoneInfo]::ConvertTimeBySystemTimeZoneId([DateTime]::UtcNow, "Mountain Standard Time").ToString('yy.M.d.HHmm')
    
  7. 7 Posted by lukasz.stanczyk on 30 Jun, 2015 06:03 PM

    lukasz.stanczyk's Avatar

    That is the workaround I used. Thank you.

    best regards,
    *Lukasz Stanczyk*
    *CTO, co-owner*

    email: [email blocked]
    office: +1 (605) 721-9893
    cell: +1 (605) 269-1177

    * PIXEL PINES*, LLC
    625 1/2 Main Street, Suite #2
    Rapid City, SD 57701

  8. lukasz.stanczyk closed this discussion on 18 Aug, 2015 05:40 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac