8dade9cb69976be6903926a055240764597f45db
[scilab.git] / scilab / modules / time / help / en_US / getdate.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) INRIA -
5  *
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="getdate">
17     <refnamediv>
18         <refname>getdate</refname>
19         <refpurpose>get date and time information</refpurpose>
20     </refnamediv>
21     <refsynopsisdiv>
22         <title>Syntax</title>
23         <synopsis>dt=getdate()
24             x=getdate("s")
25             dt=getdate(x)
26         </synopsis>
27     </refsynopsisdiv>
28     <refsection>
29         <title>Arguments</title>
30         <variablelist>
31             <varlistentry>
32                 <term>dt</term>
33                 <listitem>
34                     <para>an integer vector with 10 entries (see below)</para>
35                 </listitem>
36             </varlistentry>
37             <varlistentry>
38                 <term>x</term>
39                 <listitem>
40                     <para>an integer containing a date coded in second from 1 Jan 1970</para>
41                 </listitem>
42             </varlistentry>
43         </variablelist>
44     </refsection>
45     <refsection>
46         <title>Description</title>
47         <variablelist>
48             <varlistentry>
49                 <term>dt=getdate()</term>
50                 <listitem>
51                     <para> returns the current date in format given below:</para>
52                     <variablelist>
53                         <varlistentry>
54                             <term>dt(1)</term>
55                             <listitem>
56                                 <para>The year  as a number (with the century) between 0000 and 9999.</para>
57                             </listitem>
58                         </varlistentry>
59                         <varlistentry>
60                             <term>dt(2)</term>
61                             <listitem>
62                                 <para>The month of the year as a number between 01 and 12.</para>
63                             </listitem>
64                         </varlistentry>
65                         <varlistentry>
66                             <term>dt(3)</term>
67                             <listitem>
68                                 <para>The ISO 8601  week  number  as  a   number between 01 and 53.</para>
69                             </listitem>
70                         </varlistentry>
71                         <varlistentry>
72                             <term>dt(4)</term>
73                             <listitem>
74                                 <para>The Julian day of the year  as a number between 001 and 366.</para>
75                             </listitem>
76                         </varlistentry>
77                         <varlistentry>
78                             <term>dt(5)</term>
79                             <listitem>
80                                 <para>Specifies the weekday as a decimal number [1,7], with 1 representing Sunday.</para>
81                             </listitem>
82                         </varlistentry>
83                         <varlistentry>
84                             <term>dt(6)</term>
85                             <listitem>
86                                 <para>The day of the month as a number between 01 and 31.</para>
87                             </listitem>
88                         </varlistentry>
89                         <varlistentry>
90                             <term>dt(7)</term>
91                             <listitem>
92                                 <para>The hour of the day is output as a number between 00 and 23.</para>
93                             </listitem>
94                         </varlistentry>
95                         <varlistentry>
96                             <term>dt(8)</term>
97                             <listitem>
98                                 <para>The minute is output as a number between 00 and 59.</para>
99                             </listitem>
100                         </varlistentry>
101                         <varlistentry>
102                             <term>dt(9)</term>
103                             <listitem>
104                                 <para>The second is output as a number between 00 and 59.</para>
105                             </listitem>
106                         </varlistentry>
107                         <varlistentry>
108                             <term>dt(10)</term>
109                             <listitem>
110                                 <para>The millisecond is output as a number between 000 and 999.</para>
111                             </listitem>
112                         </varlistentry>
113                     </variablelist>
114                 </listitem>
115             </varlistentry>
116             <varlistentry>
117                 <term>x=getdate("s")</term>
118                 <listitem>
119                     <para> returns a scalar with the number of seconds since Jan 1, 1970, 00:00 UTC (Unix Time Convention)</para>
120                     <para>
121                         Please note that the return value contains the <ulink url="http://en.wikipedia.org/wiki/Leap_second">leap seconds</ulink>.
122                     </para>
123                 </listitem>
124             </varlistentry>
125             <varlistentry>
126                 <term>dt=getdate(x)</term>
127                 <listitem>
128                     <para> formats the date given by x (number of seconds since Jan 1, 1970, 00:00 UTC) in format given above.
129                         In this case dt(10) is always equal to 0.
130                     </para>
131                     <para>
132                         <literal>getdate(0)</literal> will return Jan 1, 1970, 00:00 if the time zone concerned is UTC, but if the time zone is UTC+1, hour
133                         returned will be 01:00.
134                     </para>
135                 </listitem>
136             </varlistentry>
137         </variablelist>
138     </refsection>
139     <refsection>
140         <title>Examples</title>
141         <programlisting role="example"><![CDATA[
142 w=getdate()
143 mprintf("Year:%d,Month:%d,Day:%d",w(1),w(2),w(6));
144
145 x=getdate("s")
146 getdate(x)
147  ]]></programlisting>
148     </refsection>
149     <refsection role="see also">
150         <title>See also</title>
151         <simplelist type="inline">
152             <member>
153                 <link linkend="date">date</link>
154             </member>
155             <member>
156                 <link linkend="timer">timer</link>
157             </member>
158         </simplelist>
159     </refsection>
160 </refentry>