I am using below and tried adding hrs without any luck. This returns time in UTC while I want the time in same format but 10 hrs ahead.
- task: AzureCLI@2
name: date
displayName: dateValue
inputs:
azureSubscription: 'test'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
$date = $(Get-Date -Format yyyy-MM-dd'T'HH:mm:ss)
echo "##vso[task.setvariable variable=date]$date"
CodePudding user response:
To add 10 hours to the Get-Date command in Azure CLI, you can use the AddHours method.
- task: AzureCLI@2
name: date
displayName: dateValue
inputs:
azureSubscription: 'test'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
$date = $(Get-Date).AddHours(10)
$formattedDate = $date.ToString("yyyy-MM-ddTHH:mm:ss")
echo "##vso[task.setvariable variable=date]$formattedDate"