Computer - Set Date/Time

Declaration

<AMCOMPUTER ACTIVITY="system_time" SERVER="text (options)" PORT="number" SETTIME="time/date expression" />

Related Topics   

Description

Sets the system clock to the date and time corresponding to a specific internet time server (a dedicated time server that distributes accurate time) or sets the clock to a specific date/time.

Practical Usage

Often used to set the system date and time to an accurate value. Also a practical way to synchronize the date and time in a multi-machine environment.

Parameters

General

Property Type Required Default Markup Description
Set to internet time server Text No (Empty) --- If enabled, specifies that the date and time will be set using the Internet time server.
NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes.
Use a specific time server Text No time.chu.nrc.ca
  • SERVER="tick.ucla.edu"
  • SERVER="tock.ucla.edu"
  • SERVER="time-a.nist.gov"
  • SERVER="time.nrc.ca"
If enabled, provides a list of time servers to select from. The available options are:
  • time.chu.nrc.ca
  • time.nrc.ca
  • navobs1.usnogps.navy.mil
  • navobs2.usnogps.navy.mil
  • tick.ucla.edu
  • tock.ucla.edu
  • time.nist.gov
  • time-a.nist.gov
  • time-b.nist.gov
  • tick.utoronto.ca
  • tock.utoronto.ca
Port Number No 123 PORT="142" The Internet port to use. The default port is 123.
Set to specific date and time Text No (Current) SETTIME="%DateSerial(2010,08,04) + TimeSerial(08,09,30)%" If enabled, allows you to set a specific date and time.

Description

Error Causes

On Error

NOTE:
  • The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
  • Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.

Example 1

This sample task uses specific server time to set the local computer's date and time.

Copy
<AMCOMPUTER ACTIVITY="system_time" SERVER="navobs2.usnogps.navy.mil" />

Example 2

This sample task sets the local computer to a specific date and time.

Copy
<AMCOMPUTER ACTIVITY="system_time" SETTIME="%DateSerial(2019,12,05)+TimeSerial(00,00,00)%" />