Module for managing timezone on Windows systems.


Get current hardware clock setting (UTC or localtime)


The hardware clock is always local time on Windows so this will always return "localtime"

CLI Example:

salt '*' timezone.get_hwclock

Get current numeric timezone offset from UTC (i.e. -0700)

Returns:Offset from UTC
Return type:str

CLI Example:

salt '*' timezone.get_offset

Get current timezone (i.e. America/Denver)

Returns:Timezone in unix format
Return type:str

CLI Example:

salt '*' timezone.get_zone

Get current timezone (i.e. PST, MDT, etc)

Returns:An abbreviated timezone code
Return type:str

CLI Example:

salt '*' timezone.get_zonecode

Return a list of Timezones that this module supports. These can be in either Unix or Windows format.

New in version 2018.3.3.

Parameters:unix_style (bool) -- True returns Unix-style timezones. False returns Windows-style timezones. Default is True
Returns:A list of supported timezones
Return type:list

CLI Example:

# Unix-style timezones
salt '*' timezone.list

# Windows-style timezones
salt '*' timezone.list unix_style=False

Sets the hardware clock to be either UTC or localtime


The hardware clock is always local time on Windows so this will always return False

CLI Example:

salt '*' timezone.set_hwclock UTC

Sets the timezone using the tzutil.

Parameters:timezone (str) -- A valid timezone
Returns:True if successful, otherwise False
Return type:bool
Raises:CommandExecutionError -- If invalid timezone is passed

CLI Example:

salt '*' timezone.set_zone 'America/Denver'

Compares the given timezone with the machine timezone. Mostly useful for running state checks.

Parameters:timezone (str) -- The timezone to compare. This can be in Windows or Unix format. Can be any of the values returned by the timezone.list function
Returns:True if they match, otherwise False
Return type:bool


salt '*' timezone.zone_compare 'America/Denver'