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

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Time and Date > datenum

datenum

Convert to serial date number

Syntax

N = datenum()
N = datenum(DT)
N = datenum(Y, M, D)
N = datenum(Y, M, D, H, MI, S)

Description

The datenum function converts date vectors (defined by datevec) into serial date numbers. Date numbers are serial days elapsed from some reference date. By default, the serial day 1 corresponds to 1-Jan-0000.

N = datenum() returns the serial date numbers corresponding to current date.

N = datenum(DT) converts one or more date vectors to serial date number N. DT can be an m-by-6 or m-by-3 matrix containing m full or partial date vector respectively.

N = datenum(Y, M, D) returns the serial date numbers for corresponding elements of the Y, M, and D (year, month, day) arrays. Y, M and D must be arrays of the same size (or any can be a scalar).

N = datenum(Y, M, D, H, MI, S) returns the serial date numbers for corresponding elements of the Y, M, D, H, MI, and S (year, month, day, hour, minute, and second) array values.Y, M, D, H, MI, and S must be arrays of the same size (or any can be a scalar).

Examples

// N = datenum()
datenum()

// N = datenum(DT)
A = [ 0 1 1 0 0 0 ; 2005 2 8 21 37 30 ]
datenum(A)

// N = datenum(Y, M, D)

Years = [0; 1973; 2006]
Months = [1; 8; 2]
Days = [1; 4; 8]
datenum(Years,Months,Days)

Years = [0 0 0 ; 0 0 0]
Months = [1 1 1 ; 1 1 1]
Days = [1 2 3 ; 4 5 6]
datenum(Years,Months,Days)

// N = datenum(Y, M, D, H, MI, S)

Years = grand(5,10,'uin',0,2006)
Months = grand(5,10,'uin',1,12)
Days = grand(5,10,'uin',1,28)
Hours = grand(5,10,'uin',0,23)
Minutes = grand(5,10,'uin',0,59)
Seconds = grand(5,10,'uin',0,59)
datenum(Years,Months,Days,Hours,Minutes,Seconds)

See also

Report an issue
<< date Time and Date datevec >>

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 Feb 14 14:57:23 CET 2019