supernova: fixes for boost-1.49 and gcc-4.7
[supercollider.git] / Help / Control / Date.html
blob077d8662571dd20a121dba4189d07c19785ecfb0
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="824.41">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.3px Arial; min-height: 12.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Helvetica}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #606060}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
18 p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.3px Arial}
19 span.s1 {font: 18.0px Helvetica}
20 span.s2 {font: 11.3px Arial}
21 span.s3 {font: 9.0px Monaco}
22 span.s4 {color: #0025b2}
23 span.s5 {color: #0024f8}
24 span.s6 {color: #606060}
25 span.s7 {font: 12.0px Helvetica}
26 span.s8 {font: 11.3px Arial; color: #000000}
27 span.s9 {color: #000000}
28 span.s10 {text-decoration: underline}
29 span.Apple-tab-span {white-space:pre}
30 </style>
31 </head>
32 <body>
33 <p class="p1"><span class="s1"><b>Date</b></span><span class="s2"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span><b>an object describing a point in time</b></p>
34 <p class="p2"><br></p>
35 <p class="p3"><br></p>
36 <p class="p3"><br></p>
37 <p class="p4"><b><i>Class Methods</i></b></p>
38 <p class="p3"><br></p>
39 <p class="p3"><br></p>
40 <p class="p1"><b><span class="Apple-tab-span"> </span>*new(year, month, day, hour, minute, second, dayOfWeek, rawSeconds, bootSeconds)</b></p>
41 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>Create a new date with the given properties (all numerical values).</p>
42 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>These arguments are also the names of instance variables of the date object.</p>
43 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
44 <p class="p1"><span class="Apple-tab-span"> </span><b>*getDate</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>get current date from system and create a date object from it.</p>
45 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
46 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s3">(</span></p>
47 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s4">var</span> a = <span class="s4">Date</span>.getDate;</p>
48 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.bootSeconds.postln;</p>
49 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a.dayOfWeek.postln;</p>
50 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>a</p>
51 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>)</p>
52 <p class="p3"><span class="Apple-tab-span"> </span></p>
53 <p class="p1"><span class="Apple-tab-span"> </span><b>*localtime<span class="Apple-tab-span"> </span></b>get current localized time from system and create a date object from it.</p>
54 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
55 <p class="p1"><span class="Apple-tab-span"> </span><b>*gmtime</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>get current <b>Greenwich Mean Time (GMT)</b> from system and create a date object from it.</p>
56 <p class="p3"><span class="Apple-tab-span"> </span></p>
57 <p class="p1"><span class="Apple-tab-span"> </span><b>*seed</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>get current date and return a value suitable for seeding a random number generator.</p>
58 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>see also <a href="../Core/Kernel/randomSeed.html"><span class="s5">randomSeed</span></a></p>
59 <p class="p3"><span class="Apple-tab-span"> </span></p>
60 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s3">(</span></p>
61 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s4">var</span> a = <span class="s4">Date</span>.seed;</p>
62 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s4">thisThread</span>.randSeed = a;<span class="Apple-converted-space"> </span></p>
63 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>20.do { [1,0].choose.post }; <span class="s6">""</span>.postln;</p>
64 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="s4">thisThread</span>.randSeed = a;</p>
65 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>25.do { [1,0].choose.post }; <span class="s6">""</span>.postln;</p>
66 <p class="p5"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>)</p>
67 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
68 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
69 <p class="p6"><b><i>Instance Methods</i></b></p>
70 <p class="p3"><br></p>
71 <p class="p3"><b><span class="Apple-tab-span"> </span></b></p>
72 <p class="p1"><b><span class="Apple-tab-span"> </span>localtime</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>set the receiver's time to current localtime.</p>
73 <p class="p3"><span class="Apple-tab-span"> </span></p>
74 <p class="p1"><span class="Apple-tab-span"> </span><b>gmtime</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>set the receiver's time to current <b>Greenwich Mean Time</b> (GMT).</p>
75 <p class="p3"><span class="Apple-tab-span"> </span></p>
76 <p class="p1"><span class="Apple-tab-span"> </span><b>dayStamp</b><span class="Apple-tab-span"> </span>obtain a string with the year, month and day in the format <b>YYMMDD</b>.</p>
77 <p class="p3"><span class="Apple-tab-span"> </span></p>
78 <p class="p1"><span class="Apple-tab-span"> </span><b>hourStamp</b><span class="Apple-tab-span"> </span>obtain a string in the format <b>H:M:S</b></p>
79 <p class="p3"><span class="Apple-tab-span"> </span></p>
80 <p class="p1"><span class="Apple-tab-span"> </span><b>secStamp</b><span class="Apple-tab-span"> </span>obtain a string with the seconds</p>
81 <p class="p3"><span class="Apple-tab-span"> </span></p>
82 <p class="p1"><span class="Apple-tab-span"> </span><b>stamp</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>obtain a string in the format <b>YYMMDD_HHMMSS</b>.</p>
83 <p class="p3"><span class="Apple-tab-span"> </span></p>
84 <p class="p1"><span class="Apple-tab-span"> </span><b>asSortableString</b><span class="Apple-tab-span"> </span>obtain a string in an alphabetically sortable standard database format</p>
85 <p class="p3"><span class="Apple-tab-span"> </span></p>
86 <p class="p1"><span class="Apple-tab-span"> </span><b>asctime</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>obtain a string in the format WeekdayName MonthName Time Year</p>
87 <p class="p3"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></p>
88 <p class="p1"><span class="Apple-tab-span"> </span><b>asString</b><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>returns asctime.</p>
89 <p class="p3"><span class="Apple-tab-span"> </span></p>
90 <p class="p3"><span class="Apple-tab-span"> </span></p>
91 <p class="p1"><span class="Apple-tab-span"> </span><b>format(formatstring)</b><span class="Apple-tab-span"> </span>obtain a date string with a given format.<span class="Apple-converted-space">  </span>The character % is replaced by the<span class="Apple-converted-space"> </span></p>
92 <p class="p1"><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span>appropriate value, which is derived from the letter that follows.</p>
93 <p class="p3"><span class="Apple-tab-span"> </span></p>
94 <p class="p2"><span class="s7"><span class="Apple-tab-span"> </span></span><span class="Apple-tab-span"> </span></p>
95 <p class="p7"><span class="s8"><span class="Apple-tab-span"> </span></span><span class="s4">Date</span><span class="s9">.getDate.format(</span>"Today is %A. It is around %I o'clock (%p), in %B."<span class="s9">);</span></p>
96 <p class="p5"><span class="Apple-tab-span"> </span><span class="s4">Date</span>.getDate.format(<span class="s6">"%Y-%d-%e-%Hh%m"</span>);</p>
97 <p class="p8"><span class="Apple-tab-span"> </span></p>
98 <p class="p2"><br></p>
99 <p class="p2"><br></p>
100 <p class="p9">A list of formats can be found here: <span class="s10">http://www.opengroup.org/onlinepubs/009695399/functions/strftime.html</span></p>
101 <p class="p2"><br></p>
102 <p class="p2"><br></p>
103 <p class="p2"><br></p>
104 <p class="p9"><b>Supported conversion specifications:</b></p>
105 <p class="p2"><br></p>
106 <p class="p9">%a</p>
107 <p class="p9">Replaced by the locale's abbreviated weekday name. [ tm_wday]</p>
108 <p class="p2"><br></p>
109 <p class="p9">%A</p>
110 <p class="p9">Replaced by the locale's full weekday name. [ tm_wday]</p>
111 <p class="p2"><br></p>
112 <p class="p9">%b</p>
113 <p class="p9">Replaced by the locale's abbreviated month name. [ tm_mon]</p>
114 <p class="p2"><br></p>
115 <p class="p9">%B</p>
116 <p class="p9">Replaced by the locale's full month name. [ tm_mon]</p>
117 <p class="p2"><br></p>
118 <p class="p9">%c</p>
119 <p class="p9">Replaced by the locale's appropriate date and time representation.<span class="Apple-converted-space"> </span></p>
120 <p class="p2"><br></p>
121 <p class="p9">%C</p>
122 <p class="p9">Replaced by the year divided by 100 and truncated to an integer, as a decimal number [00,99]. [ tm_year]</p>
123 <p class="p2"><br></p>
124 <p class="p9">%d</p>
125 <p class="p9">Replaced by the day of the month as a decimal number [01,31]. [ tm_mday]</p>
126 <p class="p2"><br></p>
127 <p class="p9">%D</p>
128 <p class="p9">Equivalent to %m / %d / %y. [ tm_mon, tm_mday, tm_year]</p>
129 <p class="p2"><br></p>
130 <p class="p9">%e</p>
131 <p class="p9">Replaced by the day of the month as a decimal number [1,31]; a single digit is preceded by a space. [ tm_mday]</p>
132 <p class="p2"><br></p>
133 <p class="p9">%F</p>
134 <p class="p9">Equivalent to %Y - %m - %d (the ISO 8601:2000 standard date format). [ tm_year, tm_mon, tm_mday]</p>
135 <p class="p2"><br></p>
136 <p class="p9">%g</p>
137 <p class="p9">Replaced by the last 2 digits of the week-based year (see below) as a decimal number [00,99]. [ tm_year, tm_wday, tm_yday]</p>
138 <p class="p2"><br></p>
139 <p class="p9">%G</p>
140 <p class="p9">Replaced by the week-based year (see below) as a decimal number (for example, 1977). [ tm_year, tm_wday, tm_yday]</p>
141 <p class="p2"><br></p>
142 <p class="p9">%h</p>
143 <p class="p9">Equivalent to %b. [ tm_mon]</p>
144 <p class="p2"><br></p>
145 <p class="p9">%H</p>
146 <p class="p9">Replaced by the hour (24-hour clock) as a decimal number [00,23]. [ tm_hour]</p>
147 <p class="p2"><br></p>
148 <p class="p9">%I</p>
149 <p class="p9">Replaced by the hour (12-hour clock) as a decimal number [01,12]. [ tm_hour]</p>
150 <p class="p2"><br></p>
151 <p class="p9">%j</p>
152 <p class="p9">Replaced by the day of the year as a decimal number [001,366]. [ tm_yday]</p>
153 <p class="p2"><br></p>
154 <p class="p9">%m</p>
155 <p class="p9">Replaced by the month as a decimal number [01,12]. [ tm_mon]</p>
156 <p class="p2"><br></p>
157 <p class="p9">%M</p>
158 <p class="p9">Replaced by the minute as a decimal number [00,59]. [ tm_min]</p>
159 <p class="p2"><br></p>
160 <p class="p9">%n</p>
161 <p class="p9">Replaced by a &lt;newline&gt;.</p>
162 <p class="p2"><br></p>
163 <p class="p9">%p</p>
164 <p class="p9">Replaced by the locale's equivalent of either a.m. or p.m. [ tm_hour]</p>
165 <p class="p2"><br></p>
166 <p class="p9">%r</p>
167 <p class="p9">Replaced by the time in a.m. and p.m. notation;  in the POSIX locale this shall be equivalent to %I :%M :%S%p. [ tm_hour, tm_min, tm_sec]</p>
168 <p class="p2"><br></p>
169 <p class="p9">%R</p>
170 <p class="p9">Replaced by the time in 24-hour notation (%H : %M ). [ tm_hour, tm_min]</p>
171 <p class="p2"><br></p>
172 <p class="p9">%S</p>
173 <p class="p9">Replaced by the second as a decimal number [00,60]. [ tm_sec]</p>
174 <p class="p2"><br></p>
175 <p class="p9">%t</p>
176 <p class="p9">Replaced by a &lt;tab&gt;.</p>
177 <p class="p2"><br></p>
178 <p class="p9">%T</p>
179 <p class="p9">Replaced by the time ( %H : %M : %S ). [ tm_hour, tm_min, tm_sec]</p>
180 <p class="p2"><br></p>
181 <p class="p9">%u</p>
182 <p class="p9">Replaced by the weekday as a decimal number [1,7], with 1 representing Monday. [ tm_wday]</p>
183 <p class="p2"><br></p>
184 <p class="p9">%U</p>
185 <p class="p9">Replaced by the week number of the year as a decimal number [00,53]. The first Sunday of January is the first day of week 1; days in the new year before this are in week 0. [ tm_year, tm_wday, tm_yday]</p>
186 <p class="p2"><br></p>
187 <p class="p9">%V</p>
188 <p class="p9">Replaced by the week number of the year (Monday as the first day of the week) as a decimal number [01,53]. If the week containing 1 January has four or more days in the new year, then it is considered week 1. Otherwise, it is the last week of the previous year, and the next week is week 1. Both January 4th and the first Thursday of January are always in week 1. [ tm_year, tm_wday, tm_yday]</p>
189 <p class="p2"><br></p>
190 <p class="p9">%w</p>
191 <p class="p9">Replaced by the weekday as a decimal number [0,6], with 0 representing Sunday. [ tm_wday]</p>
192 <p class="p2"><br></p>
193 <p class="p9">%W</p>
194 <p class="p9">Replaced by the week number of the year as a decimal number [00,53]. The first Monday of January is the first day of week 1; days in the new year before this are in week 0. [ tm_year, tm_wday, tm_yday]</p>
195 <p class="p2"><br></p>
196 <p class="p9">%x</p>
197 <p class="p9">Replaced by the locale's appropriate date representation.</p>
198 <p class="p2"><br></p>
199 <p class="p9">%X</p>
200 <p class="p9">Replaced by the locale's appropriate time representation.</p>
201 <p class="p2"><br></p>
202 <p class="p9">%y</p>
203 <p class="p9">Replaced by the last two digits of the year as a decimal number [00,99]. [ tm_year]</p>
204 <p class="p2"><br></p>
205 <p class="p9">%Y</p>
206 <p class="p9">Replaced by the year as a decimal number (for example, 1997). [ tm_year]</p>
207 <p class="p2"><br></p>
208 <p class="p9">%z</p>
209 <p class="p9">Replaced by the offset from UTC in the ISO 8601:2000 standard format ( +hhmm or -hhmm ), or by no characters if no timezone is determinable. For example, "-0430" means 4 hours 30 minutes behind UTC (west of Greenwich). If tm_isdst is zero, the standard time offset is used. If tm_isdst is greater than zero, the daylight savings time offset is used. If tm_isdst is negative, no characters are returned. [ tm_isdst]</p>
210 <p class="p2"><br></p>
211 <p class="p9">%Z</p>
212 <p class="p9">Replaced by the timezone name or abbreviation, or by no bytes if no timezone information exists. [ tm_isdst]</p>
213 <p class="p2"><br></p>
214 <p class="p9">%%</p>
215 <p class="p9">Replaced by %.</p>
216 <p class="p2"><br></p>
217 <p class="p9">If a conversion specification does not correspond to any of the above, the behavior is undefined.</p>
218 <p class="p2"><br></p>
219 <p class="p2"><br></p>
220 </body>
221 </html>