azure-pipelines-variable-tasks icon indicating copy to clipboard operation
azure-pipelines-variable-tasks copied to clipboard

Set variable to current date

Open dylan-smith opened this issue 6 years ago • 3 comments

Would be nice to be able to set a variable to the current date (with a specified date format). I don't believe this is possible today (without adding a custom script task to do it)

dylan-smith avatar Jun 10 '19 17:06 dylan-smith

PR welcome :)

jessehouwing avatar Oct 19 '19 09:10 jessehouwing

Bit outdated now but you can use the pipeline.startTime variable.

Example where I formatted it too variables: timestamp: $[format('{0:yyyyMMddHHmmss}', pipeline.startTime)]

DevFromDownUnder avatar May 18 '21 07:05 DevFromDownUnder

but pipeline.startTime changes per stage of the pipeline

chuckgmthompson avatar Feb 10 '22 17:02 chuckgmthompson