Main Content

setTargetTime

Set target computer date and time

Since R2025a

Description

setTargetTime(target_object) sets the host computer date and time on the target computer.

example

setTargetTime(target_object,newTime) sets the date and time specified by the newTime on the target computer.

example

setTargetTime(target_object,NTPserver) sets the specified Network Time Protocol (NTP) server date and time on the target computer.

example

Examples

collapse all

Set the host computer date and time on the target computer represented by the target object tg.

setTargetTime(tg);

Set custom date and time on the target computer represented by the target object tg.

newTime = datetime('now');
setTargetTime(tg,newTime);

Set NTP server date and time on the target computer represented by the target object tg.

setTargetTime(tg,"pool.ntp.org");

Input Arguments

collapse all

Provides access to methods that manipulate the target computer properties.

Example: tg

Date and time, specified as a datetime object. For more information about datetime objects, see datetime.

Example: datetime("23-sep-2024 12:12:12")

NTP server address, specified as a character vector or string scalar.

Example: "pool.ntp.org"

Version History

Introduced in R2025a