File: Date.html

package info (click to toggle)
calendar 1.09.3-8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 916 kB
  • ctags: 685
  • sloc: ml: 1,336; makefile: 140; sh: 14
file content (534 lines) | stat: -rw-r--r-- 30,559 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="Start" href="index.html">
<link rel="previous" href="Time.html">
<link rel="next" href="Calendar.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Time_Zone" rel="Chapter" href="Time_Zone.html">
<link title="Period" rel="Chapter" href="Period.html">
<link title="Time" rel="Chapter" href="Time.html">
<link title="Date" rel="Chapter" href="Date.html">
<link title="Calendar" rel="Chapter" href="Calendar.html">
<link title="Printer" rel="Chapter" href="Printer.html"><link title="Datatypes" rel="Section" href="#1_Datatypes">
<link title="Exceptions" rel="Section" href="#1_Exceptions">
<link title="Constructors" rel="Section" href="#1_Constructors">
<link title="Getters" rel="Section" href="#1_Getters">
<link title="Boolean operations on dates" rel="Section" href="#1_Booleanoperationsondates">
<link title="Coercions" rel="Section" href="#1_Coercions">
<link title="Period" rel="Section" href="#1_Period">
<link title="Arithmetic operations on dates and periods" rel="Section" href="#1_Arithmeticoperationsondatesandperiods">
<link title="Operations on years" rel="Section" href="#1_Operationsonyears">
<title>Date</title>
</head>
<body>
<div class="navbar"><a href="Time.html">Previous</a>
&nbsp;<a href="index.html">Up</a>
&nbsp;<a href="Calendar.html">Next</a>
</div>
<center><h1>Module <a href="type_Date.html">Date</a></h1></center>
<br>
<pre><span class="keyword">module</span> Date: <code class="code">sig</code> <a href="Date.html">..</a> <code class="code">end</code></pre>Date operations.
<p>

  This module implements operations on dates. 
  A date is a triple (year, month, day). 
<p>

  All the dates should belong to 
  <code class="code">[January, 1st 4713 BC; January 22th, 3268 AC]</code> (called the Julian period).
  An <code class="code">Out_of_bounds</code> exception is raised if you attempt to create a date 
  outside the Julian period.
<p>

  If a date <code class="code">d</code> does not exists and if <code class="code">d_bef</code> (resp. <code class="code">d_aft</code>) is 
  the last (resp. first) existing date before (resp. after) <code class="code">d</code>, 
  <code class="code">d</code> is automatically coerced to <code class="code">d_aft + d - d_bef - 1</code>.
  For example, both dates "February 29th, 2003" and 
  "February 30th, 2003" do not exist and they are coerced respectively to the 
  date "Mars 1st, 2003" and "Mars 2nd, 2003". 
  This rule is called the coercion rule.
  As an exception to the coercion rule, the date belonging to 
  <code class="code">[October 5th, 1582; October 14th, 1582]</code> do not exist and an <code class="code">Undefined</code> 
  exception is raised if you attempt to create such a date.
  Those dropped days correspond to the change from the Julian to the Gregorian
  calendar.<br>
<hr width="100%">
<br>
<a name="1_Datatypes"></a>
<h1>Datatypes</h1><br>
<pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type"></code>t </pre>
<div class="info">
Type of a date.<br>
</div>

<br><code><span class="keyword">type</span> <a name="TYPEday"></a><code class="type"></code>day = </code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Sun</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Mon</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Tue</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Wed</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Thu</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Fri</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Sat</span></code></td>

</tr></table>

<div class="info">
Days of the week.<br>
</div>

<br><code><span class="keyword">type</span> <a name="TYPEmonth"></a><code class="type"></code>month = </code><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Jan</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Feb</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Mar</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Apr</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">May</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Jun</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Jul</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Aug</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Sep</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Oct</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Nov</span></code></td>

</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span class="constructor">Dec</span></code></td>

</tr></table>

<div class="info">
Months of the year.<br>
</div>

<pre><span class="keyword">type</span> <a name="TYPEyear"></a><code class="type"></code>year = <code class="type">int</code> </pre>
<div class="info">
Year as an <code class="code">int</code>.<br>
</div>

<pre><span class="keyword">type</span> <a name="TYPEfield"></a><code class="type"></code>field = <code class="type">[ `Day | `Month | `Week | `Year ]</code> </pre>
<div class="info">
The different fields of a date.<br>
</div>

<br>
<a name="1_Exceptions"></a>
<h1>Exceptions</h1><br>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONOut_of_bounds"></a>Out_of_bounds</pre>
<div class="info">
Raised when a date is outside the Julian period.<br>
</div>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONUndefined"></a>Undefined</pre>
<div class="info">
Raised when a date belongs to <code class="code">[October 5th, 1582; October 14th, 1582]</code>.<br>
</div>
<br>
<a name="1_Constructors"></a>
<h1>Constructors</h1><br>
<pre><span class="keyword">val</span> <a name="VALmake"></a>make : <code class="type"><a href="Date.html#TYPEyear">year</a> -> int -> int -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
<code class="code">make year month day</code> makes the date year-month-day.
    A BC year <code class="code">y</code> corresponds to the year <code class="code">-(y+1)</code>.
    E.g. the years (5 BC) and (1 BC) respectively correspond to the years 
    (-4) and 0.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALlmake"></a>lmake : <code class="type">year:<a href="Date.html#TYPEyear">year</a> -> ?month:int -> ?day:int -> unit -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Labelled version of <code class="code">make</code>. 
    The default value of <code class="code">month</code> and <code class="code">day</code> is <code class="code">1</code>.<br>
<b>Since</b> 1.05<br>
</div>
<pre><span class="keyword">val</span> <a name="VALtoday"></a>today : <code class="type">unit -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Date of the current day (based on <code class="code">Time_Zone.current ()</code>).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALfrom_jd"></a>from_jd : <code class="type">int -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Make a date from its Julian day. 
    E.g. <code class="code">from_jd 0</code> returns the date 4713 BC-1-1.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALfrom_mjd"></a>from_mjd : <code class="type">int -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Make a date from its modified Julian day (i.e. Julian day - 2 400 001).
    The Modified Julian day is more manageable than the Julian day.
    E.g. <code class="code">from_mjd 0</code> returns the date 1858-11-17.<br>
</div>
<br>
<a name="1_Getters"></a>
<h1>Getters</h1><br>
<pre><span class="keyword">val</span> <a name="VALdays_in_month"></a>days_in_month : <code class="type"><a href="Date.html#TYPEt">t</a> -> int</code></pre><div class="info">
Number of days in the month of a date.
    E.g <code class="code">days_in_month (make 2003 6 26)</code> returns <code class="code">30</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALday_of_week"></a>day_of_week : <code class="type"><a href="Date.html#TYPEt">t</a> -> <a href="Date.html#TYPEday">day</a></code></pre><div class="info">
Day of the week. 
    E.g. <code class="code">day_of_week (make 2003 6 26)</code> returns <code class="code">Thu</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALday_of_month"></a>day_of_month : <code class="type"><a href="Date.html#TYPEt">t</a> -> int</code></pre><div class="info">
Day of the month. 
    E.g. <code class="code">day_of_month (make 2003 6 26)</code> returns <code class="code">26</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALday_of_year"></a>day_of_year : <code class="type"><a href="Date.html#TYPEt">t</a> -> int</code></pre><div class="info">
Day of the year.
    E.g. <code class="code">day_of_year (make 2003 1 5)</code> returns <code class="code">5</code>
    and <code class="code">day_of_year (make 2003 12 28)</code> returns <code class="code">362</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALweek"></a>week : <code class="type"><a href="Date.html#TYPEt">t</a> -> int</code></pre><div class="info">
Week. 
    E.g. <code class="code">week (make 2000 1 3)</code> returns <code class="code">1</code> and <code class="code">week (make 2000 1 2)</code> returns
    <code class="code">52</code>. <code class="code">week (make 2003 12 28)</code> returns <code class="code">52</code> and <code class="code">week (make 2003 12 29)</code>
    returns <code class="code">1</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALmonth"></a>month : <code class="type"><a href="Date.html#TYPEt">t</a> -> <a href="Date.html#TYPEmonth">month</a></code></pre><div class="info">
Month. E.g. <code class="code">month (make 2003 6 26)</code> returns <code class="code">Jun</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALyear"></a>year : <code class="type"><a href="Date.html#TYPEt">t</a> -> <a href="Date.html#TYPEyear">year</a></code></pre><div class="info">
Year. E.g. <code class="code">year (make 2003 6 26)</code> returns <code class="code">2003</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALto_jd"></a>to_jd : <code class="type"><a href="Date.html#TYPEt">t</a> -> int</code></pre><div class="info">
Julian day. E.g. <code class="code">to_jd (make (-4712) 1 1)</code> returns 0.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALto_mjd"></a>to_mjd : <code class="type"><a href="Date.html#TYPEt">t</a> -> int</code></pre><div class="info">
Modified Julian day (i.e. Julian day - 2 400 001).
    The Modified Julian day is more manageable than the Julian day. 
    E.g. <code class="code">to_mjd (make 1858 11 17)</code> returns 0.<br>
</div>
<br>
<a name="1_Booleanoperationsondates"></a>
<h1>Boolean operations on dates</h1><br>
<pre><span class="keyword">val</span> <a name="VALcompare"></a>compare : <code class="type"><a href="Date.html#TYPEt">t</a> -> <a href="Date.html#TYPEt">t</a> -> int</code></pre><div class="info">
Comparison function between two dates. 
    Same behavior as <code class="code">Pervasives.compare</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALequal"></a>equal : <code class="type"><a href="Date.html#TYPEt">t</a> -> <a href="Date.html#TYPEt">t</a> -> bool</code></pre><div class="info">
Equality function between two dates. Same behavior as <code class="code">(=)</code>.<br>
<b>Since</b> 1.09.0<br>
</div>
<pre><span class="keyword">val</span> <a name="VALis_leap_day"></a>is_leap_day : <code class="type"><a href="Date.html#TYPEt">t</a> -> bool</code></pre><div class="info">
Return <code class="code">true</code> if a date is a leap day
    (i.e. February, 24th of a leap year); <code class="code">false</code> otherwise.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALis_gregorian"></a>is_gregorian : <code class="type"><a href="Date.html#TYPEt">t</a> -> bool</code></pre><div class="info">
Return <code class="code">true</code> if a date belongs to the Gregorian calendar;
    <code class="code">false</code> otherwise.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALis_julian"></a>is_julian : <code class="type"><a href="Date.html#TYPEt">t</a> -> bool</code></pre><div class="info">
Return <code class="code">true</code> iff a date belongs to the Julian calendar;
    <code class="code">false</code> otherwise.<br>
</div>
<br>
<a name="1_Coercions"></a>
<h1>Coercions</h1><br>
<pre><span class="keyword">val</span> <a name="VALto_unixtm"></a>to_unixtm : <code class="type"><a href="Date.html#TYPEt">t</a> -> Unix.tm</code></pre><div class="info">
Convert a date into the <code class="code">Unix.tm</code> type. 
    The field <code class="code">is_isdst</code> is always <code class="code">false</code>. The fields <code class="code">Unix.tm_sec</code>, 
    <code class="code">Unix.tm_min</code> and <code class="code">Unix.tm_hour</code> are irrelevant.<br>
<b>Since</b> 1.01<br>
</div>
<pre><span class="keyword">val</span> <a name="VALfrom_unixtm"></a>from_unixtm : <code class="type">Unix.tm -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Inverse of <code class="code">to_unixtm</code>. Assume the current time zone.<br>
<b>Since</b> 1.01<br>
</div>
<pre><span class="keyword">val</span> <a name="VALto_unixfloat"></a>to_unixfloat : <code class="type"><a href="Date.html#TYPEt">t</a> -> float</code></pre><div class="info">
Convert a date to a float such than <code class="code">to_unixfloat (make 1970 1 1)</code> 
    returns <code class="code">0.0</code>. So such a float is convertible with those of the <code class="code">Unix</code> 
    module. The fractional part of the result is always <code class="code">0</code>.<br>
<b>Since</b> 1.01<br>
</div>
<pre><span class="keyword">val</span> <a name="VALfrom_unixfloat"></a>from_unixfloat : <code class="type">float -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Inverse of <code class="code">to_unixfloat</code>. Ignore the fractional part of the argument.
    Assume the current time zone.<br>
<b>Since</b> 1.01<br>
</div>
<pre><span class="keyword">val</span> <a name="VALto_business"></a>to_business : <code class="type"><a href="Date.html#TYPEt">t</a> -> <a href="Date.html#TYPEyear">year</a> * int * <a href="Date.html#TYPEday">day</a></code></pre><div class="info">
Return the "business week" and the day in this week respecting ISO 8601.
    Notice that business weeks at the beginning and end of the year can
    sometimes have year numbers which don't match the real year.
    E.g. <code class="code">to_business (make 2000 1 3)</code> returns <code class="code">2000, 1, Mon</code> and <code class="code">to_business
    (make 2000 1 2)</code> returns <code class="code">1999, 52, Sun</code>.  <code class="code">to_business (make 2003 12 28)</code>
    returns <code class="code">2003, 52, Sun</code> and <code class="code">to_business (make 2003 12 29)</code> returns <code class="code">2004,
    1, Mon</code>.<br>
<b>Since</b> 1.09.0<br>
</div>
<pre><span class="keyword">val</span> <a name="VALfrom_business"></a>from_business : <code class="type"><a href="Date.html#TYPEyear">year</a> -> int -> <a href="Date.html#TYPEday">day</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Inverse of <code class="code">to_business</code> respecting ISO-8601.
    Raise <code class="code">Invalid_argument</code> if the week is bad.
    Notice that business weeks at the beginning and end of the year
    can sometimes have year numbers which don't match the real year.<br>
<b>Since</b> 1.09.0<br>
</div>
<pre><span class="keyword">val</span> <a name="VALint_of_day"></a>int_of_day : <code class="type"><a href="Date.html#TYPEday">day</a> -> int</code></pre><div class="info">
Convert a day to an integer respecting ISO-8601.
    So, Monday is 1, Tuesday is 2, ..., and sunday is 7.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALday_of_int"></a>day_of_int : <code class="type">int -> <a href="Date.html#TYPEday">day</a></code></pre><div class="info">
Inverse of <code class="code">int_of_day</code>. 
    Raise <code class="code">Invalid_argument</code> if the argument $\notin <code class="code">1; 7</code>$.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALint_of_month"></a>int_of_month : <code class="type"><a href="Date.html#TYPEmonth">month</a> -> int</code></pre><div class="info">
Convert a month to an integer respecting ISO-8601.
    So, January is 1, February is 2 and so on.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALmonth_of_int"></a>month_of_int : <code class="type">int -> <a href="Date.html#TYPEmonth">month</a></code></pre><div class="info">
Inverse of <code class="code">int_of_month</code>. 
    Raise <code class="code">Invalid_argument</code> if the argument $\notin <code class="code">1; 12</code>$.<br>
</div>
<br>
<a name="1_Period"></a>
<h1>Period</h1><br>
<pre><span class="keyword">module</span> <a href="Date.Period.html">Period</a>: <code class="code">sig</code> <a href="Date.Period.html">..</a> <code class="code">end</code></pre><br>
<a name="1_Arithmeticoperationsondatesandperiods"></a>
<h1>Arithmetic operations on dates and periods</h1><br>
<pre><span class="keyword">val</span> <a name="VALadd"></a>add : <code class="type"><a href="Date.html#TYPEt">t</a> -> Period.t -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
<code class="code">add d p</code> returns <code class="code">d + p</code>.
    E.g. <code class="code">add (make 2003 12 31) (Period.month 1)</code> returns the date 
    2004-1-31 and <code class="code">add (make 2003 12 31) (Period.month 2)</code> returns the date 
    2004-3-2 (following the coercion rule describes in the introduction).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALsub"></a>sub : <code class="type"><a href="Date.html#TYPEt">t</a> -> <a href="Date.html#TYPEt">t</a> -> Period.t</code></pre><div class="info">
<code class="code">sub d1 d2</code> returns the period between <code class="code">d1</code> and <code class="code">d2</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALrem"></a>rem : <code class="type"><a href="Date.html#TYPEt">t</a> -> Period.t -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
<code class="code">rem d p</code> is equivalent to <code class="code">add d (Period.opp p)</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALnext"></a>next : <code class="type"><a href="Date.html#TYPEt">t</a> -> <a href="Date.html#TYPEfield">field</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
<code class="code">next d f</code> returns the date corresponding to the next specified field.\\
    E.g <code class="code">next (make 2003 12 31) `Month</code> returns the date 2004-1-31
    (i.e. one month later).<br>
</div>
<pre><span class="keyword">val</span> <a name="VALprev"></a>prev : <code class="type"><a href="Date.html#TYPEt">t</a> -> <a href="Date.html#TYPEfield">field</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
<code class="code">prev d f</code> returns the date corresponding to the previous specified 
    field.
    E.g <code class="code">prev (make 2003 12 31) `Year</code> returns the date 2002-12-31
    (i.e. one year ago).<br>
</div>
<br>
<a name="1_Operationsonyears"></a>
<h1>Operations on years</h1><br>
<pre><span class="keyword">val</span> <a name="VALis_leap_year"></a>is_leap_year : <code class="type"><a href="Date.html#TYPEyear">year</a> -> bool</code></pre><div class="info">
Return <code class="code">true</code> if a year is a leap year; <code class="code">false</code> otherwise.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALsame_calendar"></a>same_calendar : <code class="type"><a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEyear">year</a> -> bool</code></pre><div class="info">
Return <code class="code">true</code> if two years have the same calendar; <code class="code">false</code> otherwise.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALdays_in_year"></a>days_in_year : <code class="type">?month:<a href="Date.html#TYPEmonth">month</a> -> <a href="Date.html#TYPEyear">year</a> -> int</code></pre><div class="info">
Number of days in a year. 
<p>

    <code class="code">days_in_year ~month y</code> returns the number of days in the year <code class="code">y</code> up to
    the end of the given month. Thus <code class="code">days_in_year ~month:Dec y</code> is the same as
    <code class="code">days_in_year y</code>.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALweeks_in_year"></a>weeks_in_year : <code class="type"><a href="Date.html#TYPEyear">year</a> -> int</code></pre><div class="info">
Number of weeks in a year.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALweek_first_last"></a>week_first_last : <code class="type">int -> <a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEt">t</a> * <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Return the first and last days of a week in a year.<br>
<b>Since</b> 1.08<br>
</div>
<pre><span class="keyword">val</span> <a name="VALnth_weekday_of_month"></a>nth_weekday_of_month : <code class="type"><a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEmonth">month</a> -> <a href="Date.html#TYPEday">day</a> -> int -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
<code class="code">nth_weekday_of_month y m d n</code> returns the <code class="code">n</code>-th day <code class="code">d</code> in the month
    <code class="code">m</code> of the year <code class="code">y</code> (for instance the 3rd Thursday of the month).<br>
<b>Since</b> 1.09.0<br>
</div>
<pre><span class="keyword">val</span> <a name="VALcentury"></a>century : <code class="type"><a href="Date.html#TYPEyear">year</a> -> int</code></pre><div class="info">
Century of a year. 
    E.g. <code class="code">century 2000</code> returns 20 and <code class="code">century 2001</code> returns 21.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALmillenium"></a>millenium : <code class="type"><a href="Date.html#TYPEyear">year</a> -> int</code></pre><div class="info">
Millenium of a year.
    E.g. <code class="code">millenium 2000</code> returns 2 and <code class="code">millenium 2001</code> returns 3.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALsolar_number"></a>solar_number : <code class="type"><a href="Date.html#TYPEyear">year</a> -> int</code></pre><div class="info">
Solar number. 
<p>

    In the Julian calendar there is a one-to-one relationship between the
    Solar number and the day on which a particular date falls.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALindiction"></a>indiction : <code class="type"><a href="Date.html#TYPEyear">year</a> -> int</code></pre><div class="info">
Indiction. 
<p>

    The Indiction was used in the middle ages to specify the position of a 
    year in a 15 year taxation cycle. It was introduced by emperor Constantine 
    the Great on 1 September 312 and ceased to be used in 1806. 
<p>

    The Indiction has no astronomical significance.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALgolden_number"></a>golden_number : <code class="type"><a href="Date.html#TYPEyear">year</a> -> int</code></pre><div class="info">
Golden number. 
<p>

    Considering that the relationship between the moon's phases and the days 
    of the year repeats itself every 19 years, it is natural to associate a 
    number between 1 and 19 with each year. 
    This number is the so-called Golden number.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALepact"></a>epact : <code class="type"><a href="Date.html#TYPEyear">year</a> -> int</code></pre><div class="info">
Epact. 
<p>

    The Epact is a measure of the age of the moon (i.e. the number of days 
    that have passed since an "official" new moon) on a particular date.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALeaster"></a>easter : <code class="type"><a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Easter Sunday. 
<p>

    In the Christian world, Easter (and the days immediately preceding it) is 
    the celebration of the death and resurrection of Jesus in (approximately) 
    AD 30.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALcarnaval"></a>carnaval : <code class="type"><a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Carnaval Monday. <code class="code">carnaval y</code> is <code class="code">easter y - 48</code>.<br>
<b>Since</b> 1.09.0<br>
</div>
<pre><span class="keyword">val</span> <a name="VALmardi_gras"></a>mardi_gras : <code class="type"><a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Mardi Gras. <code class="code">mardi_gras y</code> is <code class="code">easter y - 47</code>.<br>
<b>Since</b> 1.09.0<br>
</div>
<pre><span class="keyword">val</span> <a name="VALash"></a>ash : <code class="type"><a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Ash Wednesday. <code class="code">ash y</code> is <code class="code">easter y - 46</code>.<br>
<b>Since</b> 1.09.0<br>
</div>
<pre><span class="keyword">val</span> <a name="VALpalm"></a>palm : <code class="type"><a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Palm Sunday. <code class="code">palm y</code> is <code class="code">easter y - 7</code>.<br>
<b>Since</b> 1.09.0<br>
</div>
<pre><span class="keyword">val</span> <a name="VALeaster_friday"></a>easter_friday : <code class="type"><a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Easter Friday. <code class="code">easter_friday y</code> is <code class="code">easter y - 2</code>.<br>
<b>Since</b> 1.09.0<br>
</div>
<pre><span class="keyword">val</span> <a name="VALeaster_saturday"></a>easter_saturday : <code class="type"><a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Easter Saturday. <code class="code">easter_saturday y</code> is <code class="code">easter y - 1</code>.<br>
<b>Since</b> 1.09.0<br>
</div>
<pre><span class="keyword">val</span> <a name="VALeaster_monday"></a>easter_monday : <code class="type"><a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Easter Monday. <code class="code">easter_monday y</code> is <code class="code">easter y + 1</code>.<br>
<b>Since</b> 1.09.0<br>
</div>
<pre><span class="keyword">val</span> <a name="VALascension"></a>ascension : <code class="type"><a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Ascension. <code class="code">ascension y</code> is <code class="code">easter y + 39</code>.<br>
<b>Since</b> 1.09.0<br>
</div>
<pre><span class="keyword">val</span> <a name="VALwithsunday"></a>withsunday : <code class="type"><a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Withsunday. <code class="code">withsunday y</code> is <code class="code">easter y + 49</code>.<br>
<b>Since</b> 1.09.0<br>
</div>
<pre><span class="keyword">val</span> <a name="VALwithmonday"></a>withmonday : <code class="type"><a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Withmonday. <code class="code">withmonday y</code> is <code class="code">easter y + 50</code>.<br>
<b>Since</b> 1.09.0<br>
</div>
<pre><span class="keyword">val</span> <a name="VALcorpus_christi"></a>corpus_christi : <code class="type"><a href="Date.html#TYPEyear">year</a> -> <a href="Date.html#TYPEt">t</a></code></pre><div class="info">
Feast of Corpus Christi. <code class="code">corpus_christi y</code> is <code class="code">easter + 60</code>.<br>
<b>Since</b> 1.09.0<br>
</div>
</body></html>