Craig Boucher
Craig Boucher

Reputation: 33

Can the timezone of a hosted agent in azure devops be changed?

I'm moving ancient code from an existing test infrastructure to ADO. Some of this code relies on the fact that it's never been run outside of PST (questionable date math). Is there some way to configure or reset the timezone in a windows hosted agent in devops? I tried just executing tzutil, but it wasn't found.

Upvotes: 2

Views: 1973

Answers (1)

Hugh Lin
Hugh Lin

Reputation: 19491

You can run the following sample bash script using Microsoft hosted agent to configure the timezone.

echo "checking date"
date
echo "setting date to Asia/Kolkata"
sudo timedatectl set-timezone "Asia/Kolkata"
date

The results in the log:

2019-07-05T20:26:48.5992486Z checking date
2019-07-05T20:26:48.5992954Z Fri Jul  5 20:26:48 UTC 2019
2019-07-05T20:26:48.5993264Z setting date to Asia/Kolkata
2019-07-05T20:26:48.9107025Z Sat Jul  6 01:56:48 IST 2019

You can refer to this ticket for details.

Upvotes: 3

Related Questions