<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>dates</title> <link rel="stylesheet" type="text/css" href="csound.css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /> <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" /> <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" /> <link rel="prev" href="date.html" title="date" /> <link rel="next" href="db.html" title="db" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">dates</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="date.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="db.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="dates"> <a id="dates"></a> <div class="titlepage"></div> <a id="IndexDates" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">dates</span> </h2> <p>dates — Returns as a string the date and time specified. </p> </div> <div class="refsect1" title="Description"> <a id="idp17578352"></a> <h2>Description</h2> <p> Returns as a string the date and time specified. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp17620544"></a> <h2>Syntax</h2> <pre class="synopsis">Sir <span class="command"><strong>dates</strong></span> [ itime]</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp17621496"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>itime</em></span> -- the time is seconds since the start of the epoch. If omited or negative the current time is taken. </p> <p> <span class="emphasis"><em>Sir</em></span> -- the date and time as a string. </p> </div> <div class="refsect1" title="Examples"> <a id="idp17622888"></a> <h2>Examples</h2> <p> Here is an example of the dates opcode. It uses the file <a class="ulink" href="examples/dates.csd" target="_top"><em class="citetitle">dates.csd</em></a>. </p> <div class="example"> <a id="idp17623856"></a> <p class="title"> <strong>Example 152. Example of the dates opcode.</strong> </p> <div class="example-contents"> <pre class="programlisting"> <span class="csdtag"><CsoundSynthesizer></span> <span class="csdtag"><CsOptions></span> <span class="comment">; Select audio/midi flags here according to platform</span> -odac <span class="comment">;;;realtime audio out</span> <span class="comment">;-iadc ;;;uncomment -iadc if realtime audio input is needed too</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o dates.wav -W ;;; for file output any platform</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></span> <span class="ohdr">sr</span> <span class="op">=</span> 44100 <span class="ohdr">ksmps</span> <span class="op">=</span> 32 <span class="ohdr">nchnls</span> <span class="op">=</span> 2 <span class="ohdr">0dbfs</span> <span class="op">=</span> 1 <span class="ohdr">seed</span> 0 <span class="comment">;each time different seed</span> <span class="oblock">instr</span> 1 <span class="comment">;;generating a different filename each time csound renders</span> itim <span class="opc">date</span> Stim <span class="opc">dates</span> itim Syear <span class="opc">strsub</span> Stim, 20, 24 Smonth <span class="opc">strsub</span> Stim, 4, 7 Sday <span class="opc">strsub</span> Stim, 8, 10 iday <span class="opc">strtod</span> Sday Shor <span class="opc">strsub</span> Stim, 11, 13 Smin <span class="opc">strsub</span> Stim, 14, 16 Ssec <span class="opc">strsub</span> Stim, 17, 19 Sfilnam <span class="opc">sprintf</span> "<span class="op">%</span>s_<span class="op">%</span>s_<span class="op">%</span>02d_<span class="op">%</span>s_<span class="op">%</span>s_<span class="op">%</span>s.wav", Syear, Smonth, iday, Shor,Smin, Ssec <span class="comment">;;rendering with random frequency, amp and pan, and writing to disk</span> ifreq <span class="opc">random</span> 400, 1000 iamp <span class="opc">random</span> .1, 1 ipan <span class="opc">random</span> 0, 1 asin <span class="opc">oscils</span> iamp, ifreq, 0 aL, aR <span class="opc">pan2</span> asin, ipan <span class="opc">fout</span> Sfilnam, 14, aL, aR <span class="opc">outs</span> aL, aR <span class="opc">printf_i</span> "File '<span class="op">%</span>s' written to the same directory as this CSD file is!\n", 1, Sfilnam <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="stamnt">i</span> 1 0 1 <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></span> </pre> </div> </div> <p><br class="example-break" /> Its output should include lines like this: </p> <pre class="screen"> File '2011_Jan_05_19_14_46.wav' written to the same directory as this CSD file is! Closing file '/home/user/csound/Output/2011_Jan_05_19_14_46.wav'... </pre> <p> </p> </div> <div class="refsect1" title="See Also"> <a id="idp17625408"></a> <h2>See Also</h2> <p> <a class="link" href="date.html" title="date"><em class="citetitle">date</em></a> </p> </div> <div class="refsect1" title="Credits"> <a id="idp17626448"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: John ffitch</td> </tr> <tr> <td>University of Bath/Codemist Ltd.</td> </tr> <tr> <td>Bath, UK</td> </tr> <tr> <td>December 2006</td> </tr> </table> <p> </p> <p>New in Csound version 5.05</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="date.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="OpcodesTop.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="db.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">date </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> db</td> </tr> </table> </div> </body> </html>