VSO(TFS) - get current date time as variable

后端 未结 4 1511
不知归路
不知归路 2020-12-05 13:34

How can I get a current date-time and pass it as a variable to some Deployment task?

4条回答
  •  醉话见心
    2020-12-05 13:50

    There is now a variable specific to a release stage named "Release.Deployment.StartTime" or if you use it in powershell the environment variable is "Release_Deployment_StartTime".

    It's in UTC and the format is "yyyy-MM-dd HH:mm:ssZ"
    ex: "2018-11-09 21:23:27Z"

    NOTE: This variable is set at the time the deployment stage is started, so if you have pre-deployment approvals the time will be set before any approvals are completed. From my testing if you have multiple stages that execute at the same time it will be the same between them, even if one stage waits for the other due to limited agent availability.

    I'm using Azure DevOps online, unsure if local TFS installations will have this.

提交回复
热议问题