<html lang="en"> <head> <title>Timing Utilities - GNU Octave</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="GNU Octave"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="System-Utilities.html#System-Utilities" title="System Utilities"> <link rel="next" href="Filesystem-Utilities.html#Filesystem-Utilities" title="Filesystem Utilities"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Timing-Utilities"></a> <p> Next: <a rel="next" accesskey="n" href="Filesystem-Utilities.html#Filesystem-Utilities">Filesystem Utilities</a>, Up: <a rel="up" accesskey="u" href="System-Utilities.html#System-Utilities">System Utilities</a> <hr> </div> <h3 class="section">36.1 Timing Utilities</h3> <p>Octave's core set of functions for manipulating time values are patterned after the corresponding functions from the standard C library. Several of these functions use a data structure for time that includes the following elements: <dl> <dt><code>usec</code><dd>Microseconds after the second (0-999999). <br><dt><code>sec</code><dd>Seconds after the minute (0-60). This number can be 60 to account for leap seconds. <br><dt><code>min</code><dd>Minutes after the hour (0-59). <br><dt><code>hour</code><dd>Hours since midnight (0-23). <br><dt><code>mday</code><dd>Day of the month (1-31). <br><dt><code>mon</code><dd>Months since January (0-11). <br><dt><code>year</code><dd>Years since 1900. <br><dt><code>wday</code><dd>Days since Sunday (0-6). <br><dt><code>yday</code><dd>Days since January 1 (0-365). <br><dt><code>isdst</code><dd>Daylight Savings Time flag. <br><dt><code>zone</code><dd>Time zone. </dl> <p class="noindent">In the descriptions of the following functions, this structure is referred to as a <var>tm_struct</var>. <!-- time src/DLD-FUNCTIONS/time.cc --> <p><a name="doc_002dtime"></a> <div class="defun"> — Loadable Function: <var>seconds</var> = <b>time</b> ()<var><a name="index-time-3101"></a></var><br> <blockquote><p>Return the current time as the number of seconds since the epoch. The epoch is referenced to 00:00:00 CUT (Coordinated Universal Time) 1 Jan 1970. For example, on Monday February 17, 1997 at 07:15:06 CUT, the value returned by <code>time</code> was 856163706. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dstrftime.html#doc_002dstrftime">strftime</a>, <a href="doc_002dstrptime.html#doc_002dstrptime">strptime</a>, <a href="doc_002dlocaltime.html#doc_002dlocaltime">localtime</a>, <a href="doc_002dgmtime.html#doc_002dgmtime">gmtime</a>, <a href="doc_002dmktime.html#doc_002dmktime">mktime</a>, <a href="doc_002dnow.html#doc_002dnow">now</a>, <a href="doc_002ddate.html#doc_002ddate">date</a>, <a href="doc_002dclock.html#doc_002dclock">clock</a>, <a href="doc_002ddatenum.html#doc_002ddatenum">datenum</a>, <a href="doc_002ddatestr.html#doc_002ddatestr">datestr</a>, <a href="doc_002ddatevec.html#doc_002ddatevec">datevec</a>, <a href="doc_002dcalendar.html#doc_002dcalendar">calendar</a>, <a href="doc_002dweekday.html#doc_002dweekday">weekday</a>. </p></blockquote></div> <!-- now scripts/time/now.m --> <p><a name="doc_002dnow"></a> <div class="defun"> — Function File: t = <b>now</b> ()<var><a name="index-now-3102"></a></var><br> <blockquote><p>Return the current local date/time as a serial day number (see <code>datenum</code>). <p>The integral part, <code>floor (now)</code> corresponds to the number of days between today and Jan 1, 0000. <p>The fractional part, <code>rem (now, 1)</code> corresponds to the current time. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dclock.html#doc_002dclock">clock</a>, <a href="doc_002ddate.html#doc_002ddate">date</a>, <a href="doc_002ddatenum.html#doc_002ddatenum">datenum</a>. </p></blockquote></div> <!-- ctime scripts/time/ctime.m --> <p><a name="doc_002dctime"></a> <div class="defun"> — Function File: <b>ctime</b> (<var>t</var>)<var><a name="index-ctime-3103"></a></var><br> <blockquote><p>Convert a value returned from <code>time</code> (or any other non-negative integer), to the local time and return a string of the same form as <code>asctime</code>. The function <code>ctime (time)</code> is equivalent to <code>asctime (localtime (time))</code>. For example: <pre class="example"> ctime (time ()) ⇒ "Mon Feb 17 01:15:06 1997" </pre> <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dasctime.html#doc_002dasctime">asctime</a>, <a href="doc_002dtime.html#doc_002dtime">time</a>, <a href="doc_002dlocaltime.html#doc_002dlocaltime">localtime</a>. </p></blockquote></div> <!-- gmtime src/DLD-FUNCTIONS/time.cc --> <p><a name="doc_002dgmtime"></a> <div class="defun"> — Loadable Function: <var>tm_struct</var> = <b>gmtime</b> (<var>t</var>)<var><a name="index-gmtime-3104"></a></var><br> <blockquote><p>Given a value returned from <code>time</code>, or any non-negative integer, return a time structure corresponding to CUT (Coordinated Universal Time). For example: <pre class="example"> gmtime (time ()) ⇒ { usec = 0 sec = 6 min = 15 hour = 7 mday = 17 mon = 1 year = 97 wday = 1 yday = 47 isdst = 0 zone = CST } </pre> <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dstrftime.html#doc_002dstrftime">strftime</a>, <a href="doc_002dstrptime.html#doc_002dstrptime">strptime</a>, <a href="doc_002dlocaltime.html#doc_002dlocaltime">localtime</a>, <a href="doc_002dmktime.html#doc_002dmktime">mktime</a>, <a href="doc_002dtime.html#doc_002dtime">time</a>, <a href="doc_002dnow.html#doc_002dnow">now</a>, <a href="doc_002ddate.html#doc_002ddate">date</a>, <a href="doc_002dclock.html#doc_002dclock">clock</a>, <a href="doc_002ddatenum.html#doc_002ddatenum">datenum</a>, <a href="doc_002ddatestr.html#doc_002ddatestr">datestr</a>, <a href="doc_002ddatevec.html#doc_002ddatevec">datevec</a>, <a href="doc_002dcalendar.html#doc_002dcalendar">calendar</a>, <a href="doc_002dweekday.html#doc_002dweekday">weekday</a>. </p></blockquote></div> <!-- localtime src/DLD-FUNCTIONS/time.cc --> <p><a name="doc_002dlocaltime"></a> <div class="defun"> — Loadable Function: <var>tm_struct</var> = <b>localtime</b> (<var>t</var>)<var><a name="index-localtime-3105"></a></var><br> <blockquote><p>Given a value returned from <code>time</code>, or any non-negative integer, return a time structure corresponding to the local time zone. <pre class="example"> localtime (time ()) ⇒ { usec = 0 sec = 6 min = 15 hour = 1 mday = 17 mon = 1 year = 97 wday = 1 yday = 47 isdst = 0 zone = CST } </pre> <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dstrftime.html#doc_002dstrftime">strftime</a>, <a href="doc_002dstrptime.html#doc_002dstrptime">strptime</a>, <a href="doc_002dgmtime.html#doc_002dgmtime">gmtime</a>, <a href="doc_002dmktime.html#doc_002dmktime">mktime</a>, <a href="doc_002dtime.html#doc_002dtime">time</a>, <a href="doc_002dnow.html#doc_002dnow">now</a>, <a href="doc_002ddate.html#doc_002ddate">date</a>, <a href="doc_002dclock.html#doc_002dclock">clock</a>, <a href="doc_002ddatenum.html#doc_002ddatenum">datenum</a>, <a href="doc_002ddatestr.html#doc_002ddatestr">datestr</a>, <a href="doc_002ddatevec.html#doc_002ddatevec">datevec</a>, <a href="doc_002dcalendar.html#doc_002dcalendar">calendar</a>, <a href="doc_002dweekday.html#doc_002dweekday">weekday</a>. </p></blockquote></div> <!-- mktime src/DLD-FUNCTIONS/time.cc --> <p><a name="doc_002dmktime"></a> <div class="defun"> — Loadable Function: <var>seconds</var> = <b>mktime</b> (<var>tm_struct</var>)<var><a name="index-mktime-3106"></a></var><br> <blockquote><p>Convert a time structure corresponding to the local time to the number of seconds since the epoch. For example: <pre class="example"> mktime (localtime (time ())) ⇒ 856163706 </pre> <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dstrftime.html#doc_002dstrftime">strftime</a>, <a href="doc_002dstrptime.html#doc_002dstrptime">strptime</a>, <a href="doc_002dlocaltime.html#doc_002dlocaltime">localtime</a>, <a href="doc_002dgmtime.html#doc_002dgmtime">gmtime</a>, <a href="doc_002dtime.html#doc_002dtime">time</a>, <a href="doc_002dnow.html#doc_002dnow">now</a>, <a href="doc_002ddate.html#doc_002ddate">date</a>, <a href="doc_002dclock.html#doc_002dclock">clock</a>, <a href="doc_002ddatenum.html#doc_002ddatenum">datenum</a>, <a href="doc_002ddatestr.html#doc_002ddatestr">datestr</a>, <a href="doc_002ddatevec.html#doc_002ddatevec">datevec</a>, <a href="doc_002dcalendar.html#doc_002dcalendar">calendar</a>, <a href="doc_002dweekday.html#doc_002dweekday">weekday</a>. </p></blockquote></div> <!-- asctime scripts/time/asctime.m --> <p><a name="doc_002dasctime"></a> <div class="defun"> — Function File: <b>asctime</b> (<var>tm_struct</var>)<var><a name="index-asctime-3107"></a></var><br> <blockquote><p>Convert a time structure to a string using the following format: "ddd mmm mm HH:MM:SS yyyy". For example: <pre class="example"> asctime (localtime (time ())) ⇒ "Mon Feb 17 01:15:06 1997" </pre> <p>This is equivalent to <code>ctime (time ())</code>. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dctime.html#doc_002dctime">ctime</a>, <a href="doc_002dlocaltime.html#doc_002dlocaltime">localtime</a>, <a href="doc_002dtime.html#doc_002dtime">time</a>. </p></blockquote></div> <!-- strftime src/DLD-FUNCTIONS/time.cc --> <p><a name="doc_002dstrftime"></a> <div class="defun"> — Loadable Function: <b>strftime</b> (<var>fmt, tm_struct</var>)<var><a name="index-strftime-3108"></a></var><br> <blockquote><p>Format the time structure <var>tm_struct</var> in a flexible way using the format string <var>fmt</var> that contains ‘<samp><span class="samp">%</span></samp>’ substitutions similar to those in <code>printf</code>. Except where noted, substituted fields have a fixed size; numeric fields are padded if necessary. Padding is with zeros by default; for fields that display a single number, padding can be changed or inhibited by following the ‘<samp><span class="samp">%</span></samp>’ with one of the modifiers described below. Unknown field specifiers are copied as normal characters. All other characters are copied to the output without change. For example: <pre class="example"> strftime ("%r (%Z) %A %e %B %Y", localtime (time ())) ⇒ "01:15:06 AM (CST) Monday 17 February 1997" </pre> <p>Octave's <code>strftime</code> function supports a superset of the ANSI C field specifiers. <p class="noindent">Literal character fields: <dl> <dt><code>%%</code><dd>% character. <br><dt><code>%n</code><dd>Newline character. <br><dt><code>%t</code><dd>Tab character. </dl> <p class="noindent">Numeric modifiers (a nonstandard extension): <dl> <dt><code>- (dash)</code><dd>Do not pad the field. <br><dt><code>_ (underscore)</code><dd>Pad the field with spaces. </dl> <p class="noindent">Time fields: <dl> <dt><code>%H</code><dd>Hour (00-23). <br><dt><code>%I</code><dd>Hour (01-12). <br><dt><code>%k</code><dd>Hour (0-23). <br><dt><code>%l</code><dd>Hour (1-12). <br><dt><code>%M</code><dd>Minute (00-59). <br><dt><code>%p</code><dd>Locale's AM or PM. <br><dt><code>%r</code><dd>Time, 12-hour (hh:mm:ss [AP]M). <br><dt><code>%R</code><dd>Time, 24-hour (hh:mm). <br><dt><code>%s</code><dd>Time in seconds since 00:00:00, Jan 1, 1970 (a nonstandard extension). <br><dt><code>%S</code><dd>Second (00-61). <br><dt><code>%T</code><dd>Time, 24-hour (hh:mm:ss). <br><dt><code>%X</code><dd>Locale's time representation (%H:%M:%S). <br><dt><code>%Z</code><dd>Time zone (EDT), or nothing if no time zone is determinable. </dl> <p class="noindent">Date fields: <dl> <dt><code>%a</code><dd>Locale's abbreviated weekday name (Sun-Sat). <br><dt><code>%A</code><dd>Locale's full weekday name, variable length (Sunday-Saturday). <br><dt><code>%b</code><dd>Locale's abbreviated month name (Jan-Dec). <br><dt><code>%B</code><dd>Locale's full month name, variable length (January-December). <br><dt><code>%c</code><dd>Locale's date and time (Sat Nov 04 12:02:33 EST 1989). <br><dt><code>%C</code><dd>Century (00-99). <br><dt><code>%d</code><dd>Day of month (01-31). <br><dt><code>%e</code><dd>Day of month ( 1-31). <br><dt><code>%D</code><dd>Date (mm/dd/yy). <br><dt><code>%h</code><dd>Same as %b. <br><dt><code>%j</code><dd>Day of year (001-366). <br><dt><code>%m</code><dd>Month (01-12). <br><dt><code>%U</code><dd>Week number of year with Sunday as first day of week (00-53). <br><dt><code>%w</code><dd>Day of week (0-6). <br><dt><code>%W</code><dd>Week number of year with Monday as first day of week (00-53). <br><dt><code>%x</code><dd>Locale's date representation (mm/dd/yy). <br><dt><code>%y</code><dd>Last two digits of year (00-99). <br><dt><code>%Y</code><dd>Year (1970-). </dl> <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dstrptime.html#doc_002dstrptime">strptime</a>, <a href="doc_002dlocaltime.html#doc_002dlocaltime">localtime</a>, <a href="doc_002dgmtime.html#doc_002dgmtime">gmtime</a>, <a href="doc_002dmktime.html#doc_002dmktime">mktime</a>, <a href="doc_002dtime.html#doc_002dtime">time</a>, <a href="doc_002dnow.html#doc_002dnow">now</a>, <a href="doc_002ddate.html#doc_002ddate">date</a>, <a href="doc_002dclock.html#doc_002dclock">clock</a>, <a href="doc_002ddatenum.html#doc_002ddatenum">datenum</a>, <a href="doc_002ddatestr.html#doc_002ddatestr">datestr</a>, <a href="doc_002ddatevec.html#doc_002ddatevec">datevec</a>, <a href="doc_002dcalendar.html#doc_002dcalendar">calendar</a>, <a href="doc_002dweekday.html#doc_002dweekday">weekday</a>. </p></blockquote></div> <!-- strptime src/DLD-FUNCTIONS/time.cc --> <p><a name="doc_002dstrptime"></a> <div class="defun"> — Loadable Function: [<var>tm_struct</var>, <var>nchars</var>] = <b>strptime</b> (<var>str, fmt</var>)<var><a name="index-strptime-3109"></a></var><br> <blockquote><p>Convert the string <var>str</var> to the time structure <var>tm_struct</var> under the control of the format string <var>fmt</var>. <p>If <var>fmt</var> fails to match, <var>nchars</var> is 0; otherwise, it is set to the position of last matched character plus 1. Always check for this unless you're absolutely sure the date string will be parsed correctly. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dstrftime.html#doc_002dstrftime">strftime</a>, <a href="doc_002dlocaltime.html#doc_002dlocaltime">localtime</a>, <a href="doc_002dgmtime.html#doc_002dgmtime">gmtime</a>, <a href="doc_002dmktime.html#doc_002dmktime">mktime</a>, <a href="doc_002dtime.html#doc_002dtime">time</a>, <a href="doc_002dnow.html#doc_002dnow">now</a>, <a href="doc_002ddate.html#doc_002ddate">date</a>, <a href="doc_002dclock.html#doc_002dclock">clock</a>, <a href="doc_002ddatenum.html#doc_002ddatenum">datenum</a>, <a href="doc_002ddatestr.html#doc_002ddatestr">datestr</a>, <a href="doc_002ddatevec.html#doc_002ddatevec">datevec</a>, <a href="doc_002dcalendar.html#doc_002dcalendar">calendar</a>, <a href="doc_002dweekday.html#doc_002dweekday">weekday</a>. </p></blockquote></div> <p>Most of the remaining functions described in this section are not patterned after the standard C library. Some are available for compatibility with <span class="sc">matlab</span> and others are provided because they are useful. <!-- clock scripts/time/clock.m --> <p><a name="doc_002dclock"></a> <div class="defun"> — Function File: <b>clock</b> ()<var><a name="index-clock-3110"></a></var><br> <blockquote><p>Return the current local date and time as a date vector. The date vector contains the following fields: current year, month (1-12), day (1-31), hour (0-23), minute (0-59), and second (0-61). The seconds field has a fractional part after the decimal point for extended accuracy. <p>For example: <pre class="example"> fix (clock ()) ⇒ [ 1993, 8, 20, 4, 56, 1 ] </pre> <p>The function clock is more accurate on systems that have the <code>gettimeofday</code> function. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dnow.html#doc_002dnow">now</a>, <a href="doc_002ddate.html#doc_002ddate">date</a>, <a href="doc_002ddatevec.html#doc_002ddatevec">datevec</a>. </p></blockquote></div> <!-- date scripts/time/date.m --> <p><a name="doc_002ddate"></a> <div class="defun"> — Function File: <b>date</b> ()<var><a name="index-date-3111"></a></var><br> <blockquote><p>Return the current date as a character string in the form DD-MMM-YYYY. <p>For example: <pre class="example"> date () ⇒ "20-Aug-1993" </pre> <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dnow.html#doc_002dnow">now</a>, <a href="doc_002dclock.html#doc_002dclock">clock</a>, <a href="doc_002ddatestr.html#doc_002ddatestr">datestr</a>, <a href="doc_002dlocaltime.html#doc_002dlocaltime">localtime</a>. </p></blockquote></div> <!-- etime scripts/time/etime.m --> <p><a name="doc_002detime"></a> <div class="defun"> — Function File: <b>etime</b> (<var>t2, t1</var>)<var><a name="index-etime-3112"></a></var><br> <blockquote><p>Return the difference in seconds between two time values returned from <code>clock</code> (<var>t2</var> - <var>t1</var>). For example: <pre class="example"> t0 = clock (); # many computations later... elapsed_time = etime (clock (), t0); </pre> <p class="noindent">will set the variable <code>elapsed_time</code> to the number of seconds since the variable <code>t0</code> was set. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dtic.html#doc_002dtic">tic</a>, <a href="doc_002dtoc.html#doc_002dtoc">toc</a>, <a href="doc_002dclock.html#doc_002dclock">clock</a>, <a href="doc_002dcputime.html#doc_002dcputime">cputime</a>, <a href="doc_002daddtodate.html#doc_002daddtodate">addtodate</a>. </p></blockquote></div> <!-- cputime src/data.cc --> <p><a name="doc_002dcputime"></a> <div class="defun"> — Built-in Function: [<var>total</var>, <var>user</var>, <var>system</var>] = <b>cputime</b> ()<var>;<a name="index-cputime-3113"></a></var><br> <blockquote><p>Return the CPU time used by your Octave session. The first output is the total time spent executing your process and is equal to the sum of second and third outputs, which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode, respectively. If your system does not have a way to report CPU time usage, <code>cputime</code> returns 0 for each of its output values. Note that because Octave used some CPU time to start, it is reasonable to check to see if <code>cputime</code> works by checking to see if the total CPU time used is nonzero. </p></blockquote></div> <!-- is_leap_year scripts/time/is_leap_year.m --> <p><a name="doc_002dis_005fleap_005fyear"></a> <div class="defun"> — Function File: <b>is_leap_year</b> ()<var><a name="index-is_005fleap_005fyear-3114"></a></var><br> — Function File: <b>is_leap_year</b> (<var>year</var>)<var><a name="index-is_005fleap_005fyear-3115"></a></var><br> <blockquote><p>Return true if <var>year</var> is a leap year and false otherwise. If no year is specified, <code>is_leap_year</code> uses the current year. For example: <pre class="example"> is_leap_year (2000) ⇒ 1 </pre> <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dweekday.html#doc_002dweekday">weekday</a>, <a href="doc_002deomday.html#doc_002deomday">eomday</a>, <a href="doc_002dcalendar.html#doc_002dcalendar">calendar</a>. </p></blockquote></div> <p><a name="doc_002dtoc"></a><!-- tic src/data.cc --> <a name="doc_002dtic"></a> <div class="defun"> — Built-in Function: <b>tic</b> ()<var><a name="index-tic-3116"></a></var><br> — Built-in Function: <b>toc</b> ()<var><a name="index-toc-3117"></a></var><br> <blockquote><p>Set or check a wall-clock timer. Calling <code>tic</code> without an output argument sets the timer. Subsequent calls to <code>toc</code> return the number of seconds since the timer was set. For example, <pre class="example"> tic (); # many computations later... elapsed_time = toc (); </pre> <p class="noindent">will set the variable <code>elapsed_time</code> to the number of seconds since the most recent call to the function <code>tic</code>. <p>If called with one output argument then this function returns a scalar of type <code>uint64</code> and the wall-clock timer is not started. <pre class="example"> t = tic; sleep (5); (double (tic ()) - double (t)) * 1e-6 ⇒ 5 </pre> <p>Nested timing with <code>tic</code> and <code>toc</code> is not supported. Therefore <code>toc</code> will always return the elapsed time from the most recent call to <code>tic</code>. <p>If you are more interested in the CPU time that your process used, you should use the <code>cputime</code> function instead. The <code>tic</code> and <code>toc</code> functions report the actual wall clock time that elapsed between the calls. This may include time spent processing other jobs or doing nothing at all. For example: <pre class="example"> tic (); sleep (5); toc () ⇒ 5 t = cputime (); sleep (5); cputime () - t ⇒ 0 </pre> <p class="noindent">(This example also illustrates that the CPU timer may have a fairly coarse resolution.) </p></blockquote></div> <!-- pause src/sysdep.cc --> <p><a name="doc_002dpause"></a> <div class="defun"> — Built-in Function: <b>pause</b> (<var>seconds</var>)<var><a name="index-pause-3118"></a></var><br> <blockquote><p>Suspend the execution of the program. If invoked without any arguments, Octave waits until you type a character. With a numeric argument, it pauses for the given number of seconds. For example, the following statement prints a message and then waits 5 seconds before clearing the screen. <pre class="example"> fprintf (stderr, "wait please...\n"); pause (5); clc; </pre> </blockquote></div> <!-- sleep src/sysdep.cc --> <p><a name="doc_002dsleep"></a> <div class="defun"> — Built-in Function: <b>sleep</b> (<var>seconds</var>)<var><a name="index-sleep-3119"></a></var><br> <blockquote><p>Suspend the execution of the program for the given number of seconds. </p></blockquote></div> <!-- usleep src/sysdep.cc --> <p><a name="doc_002dusleep"></a> <div class="defun"> — Built-in Function: <b>usleep</b> (<var>microseconds</var>)<var><a name="index-usleep-3120"></a></var><br> <blockquote><p>Suspend the execution of the program for the given number of microseconds. On systems where it is not possible to sleep for periods of time less than one second, <code>usleep</code> will pause the execution for <code>round (</code><var>microseconds</var><code> / 1e6)</code> seconds. </p></blockquote></div> <!-- datenum scripts/time/datenum.m --> <p><a name="doc_002ddatenum"></a> <div class="defun"> — Function File: <var>days</var> = <b>datenum</b> (<var>datevec</var>)<var><a name="index-datenum-3121"></a></var><br> — Function File: <var>days</var> = <b>datenum</b> (<var>year, month, day</var>)<var><a name="index-datenum-3122"></a></var><br> — Function File: <var>days</var> = <b>datenum</b> (<var>year, month, day, hour</var>)<var><a name="index-datenum-3123"></a></var><br> — Function File: <var>days</var> = <b>datenum</b> (<var>year, month, day, hour, minute</var>)<var><a name="index-datenum-3124"></a></var><br> — Function File: <var>days</var> = <b>datenum</b> (<var>year, month, day, hour, minute, second</var>)<var><a name="index-datenum-3125"></a></var><br> — Function File: <var>days</var> = <b>datenum</b> (<var>"datestr"</var>)<var><a name="index-datenum-3126"></a></var><br> — Function File: <var>days</var> = <b>datenum</b> (<var>"datestr", p</var>)<var><a name="index-datenum-3127"></a></var><br> — Function File: [<var>days</var>, <var>secs</var>] = <b>datenum</b> (<var><small class="dots">...</small></var>)<var><a name="index-datenum-3128"></a></var><br> <blockquote><p>Return the date/time input as a serial day number, with Jan 1, 0000 defined as day 1. <p>The integer part, <code>floor (</code><var>days</var><code>)</code> counts the number of complete days in the date input. <p>The fractional part, <code>rem (</code><var>days</var><code>, 1)</code> corresponds to the time on the given day. <p>The input may be a date vector (see <code>datevec</code>), datestr (see <code>datestr</code>), or directly specified as input. <p>When processing input datestrings, <var>p</var> is the year at the start of the century to which two-digit years will be referenced. If not specified, it defaults to the current year minus 50. <p>The optional output <var>secs</var> holds the time on the specified day with greater precision than <var>days</var>. <p>Notes: <ul> <li>Years can be negative and/or fractional. <li>Months below 1 are considered to be January. <li>Days of the month start at 1. <li>Days beyond the end of the month go into subsequent months. <li>Days before the beginning of the month go to the previous month. <li>Days can be fractional. </ul> <p><strong>Caution:</strong> this function does not attempt to handle Julian calendars so dates before Octave 15, 1582 are wrong by as much as eleven days. Also, be aware that only Roman Catholic countries adopted the calendar in 1582. It took until 1924 for it to be adopted everywhere. See the Wikipedia entry on the Gregorian calendar for more details. <p><strong>Warning:</strong> leap seconds are ignored. A table of leap seconds is available on the Wikipedia entry for leap seconds. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002ddatestr.html#doc_002ddatestr">datestr</a>, <a href="doc_002ddatevec.html#doc_002ddatevec">datevec</a>, <a href="doc_002dnow.html#doc_002dnow">now</a>, <a href="doc_002dclock.html#doc_002dclock">clock</a>, <a href="doc_002ddate.html#doc_002ddate">date</a>. </p></blockquote></div> <!-- datestr scripts/time/datestr.m --> <p><a name="doc_002ddatestr"></a> <div class="defun"> — Function File: <var>str</var> = <b>datestr</b> (<var>date</var>)<var><a name="index-datestr-3129"></a></var><br> — Function File: <var>str</var> = <b>datestr</b> (<var>date, f</var>)<var><a name="index-datestr-3130"></a></var><br> — Function File: <var>str</var> = <b>datestr</b> (<var>date, f, p</var>)<var><a name="index-datestr-3131"></a></var><br> <blockquote><p>Format the given date/time according to the format <code>f</code> and return the result in <var>str</var>. <var>date</var> is a serial date number (see <code>datenum</code>) or a date vector (see <code>datevec</code>). The value of <var>date</var> may also be a string or cell array of strings. <p><var>f</var> can be an integer which corresponds to one of the codes in the table below, or a date format string. <p><var>p</var> is the year at the start of the century in which two-digit years are to be interpreted in. If not specified, it defaults to the current year minus 50. <p>For example, the date 730736.65149 (2000-09-07 15:38:09.0934) would be formatted as follows: <p><table summary=""><tr align="left"><th valign="top" width="10%">Code </th><th valign="top" width="45%">Format </th><th valign="top" width="35%">Example <br></th></tr><tr align="left"><td valign="top" width="10%">0 </td><td valign="top" width="45%">dd-mmm-yyyy HH:MM:SS </td><td valign="top" width="35%">07-Sep-2000 15:38:09 <br></td></tr><tr align="left"><td valign="top" width="10%">1 </td><td valign="top" width="45%">dd-mmm-yyyy </td><td valign="top" width="35%">07-Sep-2000 <br></td></tr><tr align="left"><td valign="top" width="10%">2 </td><td valign="top" width="45%">mm/dd/yy </td><td valign="top" width="35%">09/07/00 <br></td></tr><tr align="left"><td valign="top" width="10%">3 </td><td valign="top" width="45%">mmm </td><td valign="top" width="35%">Sep <br></td></tr><tr align="left"><td valign="top" width="10%">4 </td><td valign="top" width="45%">m </td><td valign="top" width="35%">S <br></td></tr><tr align="left"><td valign="top" width="10%">5 </td><td valign="top" width="45%">mm </td><td valign="top" width="35%">09 <br></td></tr><tr align="left"><td valign="top" width="10%">6 </td><td valign="top" width="45%">mm/dd </td><td valign="top" width="35%">09/07 <br></td></tr><tr align="left"><td valign="top" width="10%">7 </td><td valign="top" width="45%">dd </td><td valign="top" width="35%">07 <br></td></tr><tr align="left"><td valign="top" width="10%">8 </td><td valign="top" width="45%">ddd </td><td valign="top" width="35%">Thu <br></td></tr><tr align="left"><td valign="top" width="10%">9 </td><td valign="top" width="45%">d </td><td valign="top" width="35%">T <br></td></tr><tr align="left"><td valign="top" width="10%">10 </td><td valign="top" width="45%">yyyy </td><td valign="top" width="35%">2000 <br></td></tr><tr align="left"><td valign="top" width="10%">11 </td><td valign="top" width="45%">yy </td><td valign="top" width="35%">00 <br></td></tr><tr align="left"><td valign="top" width="10%">12 </td><td valign="top" width="45%">mmmyy </td><td valign="top" width="35%">Sep00 <br></td></tr><tr align="left"><td valign="top" width="10%">13 </td><td valign="top" width="45%">HH:MM:SS </td><td valign="top" width="35%">15:38:09 <br></td></tr><tr align="left"><td valign="top" width="10%">14 </td><td valign="top" width="45%">HH:MM:SS PM </td><td valign="top" width="35%">03:38:09 PM <br></td></tr><tr align="left"><td valign="top" width="10%">15 </td><td valign="top" width="45%">HH:MM </td><td valign="top" width="35%">15:38 <br></td></tr><tr align="left"><td valign="top" width="10%">16 </td><td valign="top" width="45%">HH:MM PM </td><td valign="top" width="35%">03:38 PM <br></td></tr><tr align="left"><td valign="top" width="10%">17 </td><td valign="top" width="45%">QQ-YY </td><td valign="top" width="35%">Q3-00 <br></td></tr><tr align="left"><td valign="top" width="10%">18 </td><td valign="top" width="45%">QQ </td><td valign="top" width="35%">Q3 <br></td></tr><tr align="left"><td valign="top" width="10%">19 </td><td valign="top" width="45%">dd/mm </td><td valign="top" width="35%">13/03 <br></td></tr><tr align="left"><td valign="top" width="10%">20 </td><td valign="top" width="45%">dd/mm/yy </td><td valign="top" width="35%">13/03/95 <br></td></tr><tr align="left"><td valign="top" width="10%">21 </td><td valign="top" width="45%">mmm.dd.yyyy HH:MM:SS </td><td valign="top" width="35%">Mar.03.1962 13:53:06 <br></td></tr><tr align="left"><td valign="top" width="10%">22 </td><td valign="top" width="45%">mmm.dd.yyyy </td><td valign="top" width="35%">Mar.03.1962 <br></td></tr><tr align="left"><td valign="top" width="10%">23 </td><td valign="top" width="45%">mm/dd/yyyy </td><td valign="top" width="35%">03/13/1962 <br></td></tr><tr align="left"><td valign="top" width="10%">24 </td><td valign="top" width="45%">dd/mm/yyyy </td><td valign="top" width="35%">12/03/1962 <br></td></tr><tr align="left"><td valign="top" width="10%">25 </td><td valign="top" width="45%">yy/mm/dd </td><td valign="top" width="35%">95/03/13 <br></td></tr><tr align="left"><td valign="top" width="10%">26 </td><td valign="top" width="45%">yyyy/mm/dd </td><td valign="top" width="35%">1995/03/13 <br></td></tr><tr align="left"><td valign="top" width="10%">27 </td><td valign="top" width="45%">QQ-YYYY </td><td valign="top" width="35%">Q4-2132 <br></td></tr><tr align="left"><td valign="top" width="10%">28 </td><td valign="top" width="45%">mmmyyyy </td><td valign="top" width="35%">Mar2047 <br></td></tr><tr align="left"><td valign="top" width="10%">29 </td><td valign="top" width="45%">yyyymmdd </td><td valign="top" width="35%">20470313 <br></td></tr><tr align="left"><td valign="top" width="10%">30 </td><td valign="top" width="45%">yyyymmddTHHMMSS </td><td valign="top" width="35%">20470313T132603 <br></td></tr><tr align="left"><td valign="top" width="10%">31 </td><td valign="top" width="45%">yyyy-mm-dd HH:MM:SS </td><td valign="top" width="35%">1047-03-13 13:26:03 <br></td></tr></table> <p>If <var>f</var> is a format string, the following symbols are recognized: <p><table summary=""><tr align="left"><th valign="top" width="10%">Symbol </th><th valign="top" width="70%">Meaning </th><th valign="top" width="20%">Example <br></th></tr><tr align="left"><td valign="top" width="10%">yyyy </td><td valign="top" width="70%">Full year </td><td valign="top" width="20%">2005 <br></td></tr><tr align="left"><td valign="top" width="10%">yy </td><td valign="top" width="70%">Two-digit year </td><td valign="top" width="20%">2005 <br></td></tr><tr align="left"><td valign="top" width="10%">mmmm </td><td valign="top" width="70%">Full month name </td><td valign="top" width="20%">December <br></td></tr><tr align="left"><td valign="top" width="10%">mmm </td><td valign="top" width="70%">Abbreviated month name </td><td valign="top" width="20%">Dec <br></td></tr><tr align="left"><td valign="top" width="10%">mm </td><td valign="top" width="70%">Numeric month number (padded with zeros) </td><td valign="top" width="20%">01, 08, 12 <br></td></tr><tr align="left"><td valign="top" width="10%">m </td><td valign="top" width="70%">First letter of month name (capitalized) </td><td valign="top" width="20%">D <br></td></tr><tr align="left"><td valign="top" width="10%">dddd </td><td valign="top" width="70%">Full weekday name </td><td valign="top" width="20%">Sunday <br></td></tr><tr align="left"><td valign="top" width="10%">ddd </td><td valign="top" width="70%">Abbreviated weekday name </td><td valign="top" width="20%">Sun <br></td></tr><tr align="left"><td valign="top" width="10%">dd </td><td valign="top" width="70%">Numeric day of month (padded with zeros) </td><td valign="top" width="20%">11 <br></td></tr><tr align="left"><td valign="top" width="10%">d </td><td valign="top" width="70%">First letter of weekday name (capitalized) </td><td valign="top" width="20%">S <br></td></tr><tr align="left"><td valign="top" width="10%">HH </td><td valign="top" width="70%">Hour of day, padded with zeros if PM is set </td><td valign="top" width="20%">09:00 <br></td></tr><tr align="left"><td valign="top" width="10%"></td><td valign="top" width="70%">and not padded with zeros otherwise </td><td valign="top" width="20%">9:00 AM <br></td></tr><tr align="left"><td valign="top" width="10%">MM </td><td valign="top" width="70%">Minute of hour (padded with zeros) </td><td valign="top" width="20%">10:05 <br></td></tr><tr align="left"><td valign="top" width="10%">SS </td><td valign="top" width="70%">Second of minute (padded with zeros) </td><td valign="top" width="20%">10:05:03 <br></td></tr><tr align="left"><td valign="top" width="10%">FFF </td><td valign="top" width="70%">Milliseconds of second (padded with zeros) </td><td valign="top" width="20%">10:05:03.012 <br></td></tr><tr align="left"><td valign="top" width="10%">AM </td><td valign="top" width="70%">Use 12-hour time format </td><td valign="top" width="20%">11:30 AM <br></td></tr><tr align="left"><td valign="top" width="10%">PM </td><td valign="top" width="70%">Use 12-hour time format </td><td valign="top" width="20%">11:30 PM <br></td></tr></table> <p>If <var>f</var> is not specified or is <code>-1</code>, then use 0, 1 or 16, depending on whether the date portion or the time portion of <var>date</var> is empty. <p>If <var>p</var> is nor specified, it defaults to the current year minus 50. <p>If a matrix or cell array of dates is given, a column vector of date strings is returned. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002ddatenum.html#doc_002ddatenum">datenum</a>, <a href="doc_002ddatevec.html#doc_002ddatevec">datevec</a>, <a href="doc_002ddate.html#doc_002ddate">date</a>, <a href="doc_002dnow.html#doc_002dnow">now</a>, <a href="doc_002dclock.html#doc_002dclock">clock</a>. </p></blockquote></div> <!-- datevec scripts/time/datevec.m --> <p><a name="doc_002ddatevec"></a> <div class="defun"> — Function File: <var>v</var> = <b>datevec</b> (<var>date</var>)<var><a name="index-datevec-3132"></a></var><br> — Function File: <var>v</var> = <b>datevec</b> (<var>date, f</var>)<var><a name="index-datevec-3133"></a></var><br> — Function File: <var>v</var> = <b>datevec</b> (<var>date, p</var>)<var><a name="index-datevec-3134"></a></var><br> — Function File: <var>v</var> = <b>datevec</b> (<var>date, f, p</var>)<var><a name="index-datevec-3135"></a></var><br> — Function File: [<var>y</var>, <var>m</var>, <var>d</var>, <var>h</var>, <var>mi</var>, <var>s</var>] = <b>datevec</b> (<var><small class="dots">...</small></var>)<var><a name="index-datevec-3136"></a></var><br> <blockquote><p>Convert a serial date number (see <code>datenum</code>) or date string (see <code>datestr</code>) into a date vector. <p>A date vector is a row vector with six members, representing the year, month, day, hour, minute, and seconds respectively. <p><var>f</var> is the format string used to interpret date strings (see <code>datestr</code>). <p><var>p</var> is the year at the start of the century to which two-digit years will be referenced. If not specified, it defaults to the current year minus 50. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002ddatenum.html#doc_002ddatenum">datenum</a>, <a href="doc_002ddatestr.html#doc_002ddatestr">datestr</a>, <a href="doc_002dclock.html#doc_002dclock">clock</a>, <a href="doc_002dnow.html#doc_002dnow">now</a>, <a href="doc_002ddate.html#doc_002ddate">date</a>. </p></blockquote></div> <!-- addtodate scripts/time/addtodate.m --> <p><a name="doc_002daddtodate"></a> <div class="defun"> — Function File: <var>d</var> = <b>addtodate</b> (<var>d, q, f</var>)<var><a name="index-addtodate-3137"></a></var><br> <blockquote><p>Add <var>q</var> amount of time (with units <var>f</var>) to the serial datenum, <var>d</var>. <p><var>f</var> must be one of "year", "month", "day", "hour", "minute", "second", or "millisecond". <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002ddatenum.html#doc_002ddatenum">datenum</a>, <a href="doc_002ddatevec.html#doc_002ddatevec">datevec</a>, <a href="doc_002detime.html#doc_002detime">etime</a>. </p></blockquote></div> <!-- calendar scripts/time/calendar.m --> <p><a name="doc_002dcalendar"></a> <div class="defun"> — Function File: <var>c</var> = <b>calendar</b> ()<var><a name="index-calendar-3138"></a></var><br> — Function File: <var>c</var> = <b>calendar</b> (<var>d</var>)<var><a name="index-calendar-3139"></a></var><br> — Function File: <var>c</var> = <b>calendar</b> (<var>y, m</var>)<var><a name="index-calendar-3140"></a></var><br> — Function File: <b>calendar</b> (<var><small class="dots">...</small></var>)<var><a name="index-calendar-3141"></a></var><br> <blockquote><p>Return the current monthly calendar in a 6x7 matrix. <p>If <var>d</var> is specified, return the calendar for the month containing the date <var>d</var>, which must be a serial date number or a date string. <p>If <var>y</var> and <var>m</var> are specified, return the calendar for year <var>y</var> and month <var>m</var>. <p>If no output arguments are specified, print the calendar on the screen instead of returning a matrix. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002ddatenum.html#doc_002ddatenum">datenum</a>, <a href="doc_002ddatestr.html#doc_002ddatestr">datestr</a>. </p></blockquote></div> <!-- weekday scripts/time/weekday.m --> <p><a name="doc_002dweekday"></a> <div class="defun"> — Function File: [<var>n</var>, <var>s</var>] = <b>weekday</b> (<var>d</var>)<var><a name="index-weekday-3142"></a></var><br> — Function File: [<var>n</var>, <var>s</var>] = <b>weekday</b> (<var>d, format</var>)<var><a name="index-weekday-3143"></a></var><br> <blockquote><p>Return the day of the week as a number in <var>n</var> and as a string in <var>s</var>. The days of the week are numbered 1–7 with the first day being Sunday. <p><var>d</var> is a serial date number or a date string. <p>If the string <var>format</var> is not present or is equal to "short" then <var>s</var> will contain the abbreviated name of the weekday. If <var>format</var> is "long" then <var>s</var> will contain the full name. <p>Table of return values based on <var>format</var>: <p><table summary=""><tr align="left"><th valign="top" width="6%"><var>n</var> </th><th valign="top" width="13%">"short" </th><th valign="top" width="16%">"long" <br></th></tr><tr align="left"><td valign="top" width="6%">1 </td><td valign="top" width="13%">Sun </td><td valign="top" width="16%">Sunday <br></td></tr><tr align="left"><td valign="top" width="6%">2 </td><td valign="top" width="13%">Mon </td><td valign="top" width="16%">Monday <br></td></tr><tr align="left"><td valign="top" width="6%">3 </td><td valign="top" width="13%">Tue </td><td valign="top" width="16%">Tuesday <br></td></tr><tr align="left"><td valign="top" width="6%">4 </td><td valign="top" width="13%">Wed </td><td valign="top" width="16%">Wednesday <br></td></tr><tr align="left"><td valign="top" width="6%">5 </td><td valign="top" width="13%">Thu </td><td valign="top" width="16%">Thursday <br></td></tr><tr align="left"><td valign="top" width="6%">6 </td><td valign="top" width="13%">Fri </td><td valign="top" width="16%">Friday <br></td></tr><tr align="left"><td valign="top" width="6%">7 </td><td valign="top" width="13%">Sat </td><td valign="top" width="16%">Saturday <br></td></tr></table> <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002deomday.html#doc_002deomday">eomday</a>, <a href="doc_002dis_005fleap_005fyear.html#doc_002dis_005fleap_005fyear">is_leap_year</a>, <a href="doc_002dcalendar.html#doc_002dcalendar">calendar</a>, <a href="doc_002ddatenum.html#doc_002ddatenum">datenum</a>, <a href="doc_002ddatevec.html#doc_002ddatevec">datevec</a>. </p></blockquote></div> <!-- eomday scripts/time/eomday.m --> <p><a name="doc_002deomday"></a> <div class="defun"> — Function File: <var>e</var> = <b>eomday</b> (<var>y, m</var>)<var><a name="index-eomday-3144"></a></var><br> <blockquote><p>Return the last day of the month <var>m</var> for the year <var>y</var>. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002dweekday.html#doc_002dweekday">weekday</a>, <a href="doc_002ddatenum.html#doc_002ddatenum">datenum</a>, <a href="doc_002ddatevec.html#doc_002ddatevec">datevec</a>, <a href="doc_002dis_005fleap_005fyear.html#doc_002dis_005fleap_005fyear">is_leap_year</a>, <a href="doc_002dcalendar.html#doc_002dcalendar">calendar</a>. </p></blockquote></div> <!-- datetick scripts/time/datetick.m --> <p><a name="doc_002ddatetick"></a> <div class="defun"> — Function File: <b>datetick</b> ()<var><a name="index-datetick-3145"></a></var><br> — Function File: <b>datetick</b> (<var>form</var>)<var><a name="index-datetick-3146"></a></var><br> — Function File: <b>datetick</b> (<var>axis, form</var>)<var><a name="index-datetick-3147"></a></var><br> — Function File: <b>datetick</b> (<var><small class="dots">...</small>, "keeplimits"</var>)<var><a name="index-datetick-3148"></a></var><br> — Function File: <b>datetick</b> (<var><small class="dots">...</small>, "keepticks"</var>)<var><a name="index-datetick-3149"></a></var><br> — Function File: <b>datetick</b> (<var><small class="dots">...</small>ax, <small class="dots">...</small></var>)<var><a name="index-datetick-3150"></a></var><br> <blockquote><p>Add date formatted tick labels to an axis. The axis the apply the ticks to is determined by <var>axis</var> that can take the values "x", "y" or "z". The default value is "x". The formatting of the labels is determined by the variable <var>form</var>, that can either be a string in the format needed by <code>dateform</code>, or a positive integer that can be accepted by <code>datestr</code>. <!-- Texinfo @sp should work but in practice produces ugly results for HTML. --> <!-- A simple blank line produces the correct behavior. --> <!-- @sp 1 --> <p class="noindent"><strong>See also:</strong> <a href="doc_002ddatenum.html#doc_002ddatenum">datenum</a>, <a href="doc_002ddatestr.html#doc_002ddatestr">datestr</a>. </p></blockquote></div> </body></html>