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


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


[datetime, timezone, Dst] = clock()


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

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.

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.


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.


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

 tz  =

 Dst  =

More information, on Windows:

--> 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)


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

Copyright (c) 2022-2023 (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:
Mon Mar 27 11:52:45 GMT 2023