Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - English


clock

Return the current Gregorian datetime and international time zone of the computer's clock

Syntax

[datetime, timezone, Dst] = clock()

Arguments

datetime
[year, month, day, hour, minute, second] vector. The first five elements are integers. The second element is accurate up to the millisecond.

timezone
A scalar multiple of 0.25 in [-12, 12]. Most of geographical areas have an integer time zone. A few are on a half-an-hour or even a quarter time zone. timezone < 0 for Brasil, and > 0 for France, Russia, and Japan, etc.

Dst
0 or 1: Daylight saving time. 1 if the time area of the computer is registered to apply a Daylight saving time offset, and currently applies it ; 0 otherwise.

Description

clock() returns the current state of the clock of the computer. This clock is registered for a given time zone and area, and provides the local legal time.

The time zone of the computer can also be retrieved through the computer's OS. However, when a Daylight saving time offset applies, the returned time zone may include it.

Examples

[datetime, tz, Dst] = clock()
--> [datetime, tz, Dst] = clock()
 datetime  =
   2020.   7.   23.   21.   26.   36.979

 tz  =
   1.

 Dst  =
   1.

More information, on Windows:

powershell("Get-Timezone")(3:8)
--> powershell("Get-Timezone")(3:8)
 ans  =
  "Id                         : Romance Standard Time"
  "DisplayName                : (UTC+01:00) Bruxelles, Copenhague, Madrid, Paris"
  "StandardName               : Paris, Madrid"
  "DaylightName               : Paris, Madrid (heure d'été)"
  "BaseUtcOffset              : 01:00:00"
  "SupportsDaylightSavingTime : True"

See also

  • getdate — Current datetime or POSIX timestamp from computer's clock. Datetimes from given timestamps
  • datevec — Date components
  • datenum — Convert to serial date number
  • calendar — Calendar of a given month and year (Gregorian dates)

History

VersionDescription
6.1.1 Time zone and Daylight saving time outputs added.
Report an issue
<< calendarDuration Time and Date date >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:13:10 CEST 2024