-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
935 lines (925 loc) · 67.3 KB
/
index.html
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
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
<!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" xml:lang="en" lang="en">
<head>
<title>Calendar Converter</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<meta name="keywords" content="calendar, converter, Julian, Gregorian, Islamic, Hebrew, Persian, Mayan, French, Indian" />
<meta name="description" content="Calendar Converter" />
<meta name="author" content="John Walker" />
<meta name="robots" content="index" />
<script type="text/javascript" language="JavaScript" src="astro.js">
</script>
<script type="text/javascript" language="JavaScript" src="calendar.js">
</script>
<link rel="stylesheet" type="text/css" href="style.css" /> </head>
<body class="main">
<h1>Calendar Converter</h1>
<hr />Welcome to <a href="/">Fourmilab</a>'s calendar converter! This page allows you to interconvert dates in a variety of calendars, both civil and computer-related. All calculations are done in JavaScript executed in your own browser; complete source
code is embedded in or linked to this page, and you're free to <a href="calcalc.zip">download</a>these files to your own computer and use them even when not connected to the Internet. To use the page, your browser must support JavaScript and you must
not have disabled execution of that language. Let's see ...
<center>
<form name="warning" action="javascript:return%20false;" id="warning">
<input type="text" name="warning" style="background-color: #ffa0a0; color: #000000;" value="Your browser doesn't support JavaScript or it is disabled--you cannot use this calculator." size="70" class="ctr" readonly="readonly" /> </form>
</center>
<script type="text/javascript" language="JavaScript">
// <![CDATA[
<!--
// Clear out "sorry, no JavaScript" message from text box.
document.warning.warning.value = "Your browser supports JavaScript - you can use this calculator.";
document.warning.warning.style.backgroundColor = "#a0ffa0";
// -->
//]]>
</script>If the box above says "Your browser supports JavaScript", you're in business; simply enter a date in any of the boxes below and press the "Calculate" button to show that date in all of the other calendars.
<h3>
<a name="gregorianCalendar" id="gregorianCalendar">Gregorian Calendar</a>
</h3>
<form name="gregorianForm" action="javascript:return%20false;" id="gregorianForm">
<table class="l" summary="">
<tr>
<th>Date:</th>
<td align="center">
<input type="text" name="year" value="1998" size="5" />
<select name="month" size="1">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<input type="text" name="day" value="1" size="3" />
<br />
<input type="text" name="leap" value="" size="12" class="ctr" readonly="readonly" /> </td>
</tr>
<tr>
<th>Time:</th>
<td align="center">
<input type="text" name="hour" value="00" size="2" />:
<input type="text" name="min" value="00" size="2" />:
<input type="text" name="sec" value="00" size="2" /> </td>
</tr>
<tr>
<th>Weekday:</th>
<td align="center">
<input type="text" name="wday" value="" size="9" class="ctr" readonly="readonly" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcGregorian();" />   
<input type="button" value="Today" onclick="setDateToToday(); calcGregorian();" /> </td>
</tr>
</table>
</form>
<script type="text/javascript" language="JavaScript">
// <![CDATA[
<!--
// Preset the fields in the request form to today's date.
setDateToToday();
// -->
//]]>;
</script>
<p>The Gregorian calendar was <a href="IG_Latin.html" target="_blank">proclaimed</a>by Pope Gregory XIII and took effect in most Catholic states in 1582, in which October 4, 1582 of the Julian calendar was followed by October 15 in the new calendar,
correcting for the accumulated discrepancy between the Julian calendar and the equinox as of that date. When comparing historical dates, it's important to note that the Gregorian calendar, used universally today in Western countries and in international
commerce, was adopted at different times by different countries. Britain and her colonies (including what is now the United States), did not switch to the Gregorian calendar until 1752, when Wednesday 2nd September in the Julian calendar dawned
as Thursday the 14th in the Gregorian.</p>
<p>The Gregorian calendar is a minor correction to the Julian. In the Julian calendar every fourth year is a leap year in which February has 29, not 28 days, but in the Gregorian, years divisible by 100 are <em>not</em>leap years unless they are also
divisible by 400. How prescient was Pope Gregory! Whatever the problems of Y2K, they won't include sloppy programming which assumes every year divisible by 4 is a leap year since 2000, unlike the previous and subsequent years divisible by 100, <em>is</em>a
leap year. As in the Julian calendar, days are considered to begin at midnight.</p>
<p>The average length of a year in the Gregorian calendar is 365.2425 days compared to the actual solar tropical year (time from equinox to equinox) of 365.24219878 days, so the calendar accumulates one day of error with respect to the solar year about
every 3300 years. As a purely solar calendar, no attempt is made to synchronise the start of months to the phases of the Moon.</p>
<p>While one can't properly speak of "Gregorian dates" prior to the adoption of the calendar in 1582, the calendar can be extrapolated to prior dates. In doing so, this implementation uses the convention that the year prior to year 1 is year
0. This differs from the Julian calendar in which there is no year 0 — the year before year 1 in the Julian calendar is year — 1. The date December 30th, 0 in the Gregorian calendar corresponds to January 1st, 1 in the Julian calendar.</p>
<p>A slight modification of the Gregorian calendar would make it even more precise. If you add the additional rule that years evenly divisible by 4000 are <em>not</em>leap years, you obtain an average solar year of 365.24225 days per year which, compared
to the actual mean year of 365.24219878, is equivalent to an error of one day over a period of about 19,500 years; this is comparable to errors due to tidal braking of the rotation of the Earth.</p>
<br clear="left" />
<h3>
<a name="julianDay" id="julianDay">Julian Day</a>
</h3>
<form name="julianDayForm" action="javascript:return%20false;" id="julianDayForm">
<table class="l" summary="">
<tr>
<td align="center"> <b>Julian day:</b>
<input type="text" name="day" value="" size="16" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcJulian();" /> </td>
</tr>
</table>
</form>
<p>Astronomers, unlike historians, frequently need to do arithmetic with dates. For example: a double star goes into eclipse every 1583.6 days and its last mid-eclipse was measured to be on October 17, 2003 at 21:17 UTC. When is the next? Well, you could
get out your calendar and count days, but it's far easier to convert all the quantities in question to Julian day numbers and simply add or subtract. Julian days simply enumerate the days and fraction which have elapsed since the start of the <em>Julian era</em>,
which is defined as beginning at noon on Monday, 1st January of year 4713 <span class="bcad">B.C.E.</span>in the Julian calendar. This date is defined in terms of a cycle of years, but has the additional advantage that all known historical astronomical
observations bear positive Julian day numbers, and periods can be determined and events extrapolated by simple addition and subtraction. Julian dates are a tad eccentric in starting at noon, but then so are astronomers (and systems programmers!)—when
you've become accustomed to rising after the "crack of noon" and doing most of your work when the Sun is down, you appreciate recording your results in a calendar where the date doesn't change in the middle of your workday. But even the
Julian day convention bears witness to the eurocentrism of 19th century astronomy—noon at Greenwich is midnight on the other side of the world. But the Julian day notation is so deeply embedded in astronomy that it is unlikely to be displaced
at any time in the foreseeable future. It is an ideal system for storing dates in computer programs, free of cultural bias and discontinuities at various dates, and can be readily transformed into other calendar systems, as the source code for this
page illustrates. Use Julian days and fractions (stored in 64 bit or longer floating point numbers) in your programs, and be ready for Y10K, Y100K, and Y1MM! </p>
<br clear="left" />
<h3>
<a name="modifiedJulianDay" id="modifiedJulianDay">Modified Julian Day</a>
</h3>
<form name="modifiedJulianDayForm" action="javascript:return%20false;" id="modifiedJulianDayForm">
<table class="l" summary="">
<tr>
<td align="center"> <b>Modified Julian day:</b>
<input type="text" name="day" value="" size="16" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcModifiedJulian();" /> </td>
</tr>
</table>
</form>
<p>While any event in recorded human history can be written as a positive Julian day number, when working with contemporary events all those digits can be cumbersome. A <em>Modified Julian Day</em>(MJD) is created by subtracting 2400000.5 from a Julian
day number, and thus represents the number of days elapsed since midnight (00:00) Universal Time on November 17, 1858. Modified Julian Days are widely used to specify the epoch in tables of orbital elements of artificial Earth satellites. Since
no such objects existed prior to October 4, 1957, all satellite-related MJDs are positive.</p>
<br clear="left" />
<h3>
<a name="julianCalendar" id="julianCalendar">Julian Calendar</a>
</h3>
<form name="julianForm" action="javascript:return%20false;" id="julianForm">
<table class="l" summary="">
<tr>
<th>Date:</th>
<td align="center">
<input type="text" name="year" value="" size="5" />
<select name="month" size="1">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<input type="text" name="day" value="" size="3" />
<br />
<input type="text" name="leap" value="" size="12" class="ctr" readonly="readonly" />
<br />
<input type="text" name="wday" value="" size="9" class="ctr" readonly="readonly" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcJulianCalendar();" /> </td>
</tr>
</table>
</form>
<p>The Julian calendar was proclaimed by Julius Cæsar in 46 <span class="bcad">B.C.</span>and underwent several modifications before reaching its final form in 8 <span class="bcad">C.E.</span>The Julian calendar differs from the Gregorian only
in the determination of leap years, lacking the correction for years divisible by 100 and 400 in the Gregorian calendar. In the Julian calendar, any positive year is a leap year if divisible by 4. (Negative years are leap years if the absolute value
divided by 4 yields a remainder of 1.) Days are considered to begin at midnight.</p>
<p>In the Julian calendar the average year has a length of 365.25 days. compared to the actual solar tropical year of 365.24219878 days. The calendar thus accumulates one day of error with respect to the solar year every 128 years. Being a purely solar
calendar, no attempt is made to synchronise the start of months to the phases of the Moon.</p>
<br clear="left" />
<h3>
<a name="gregorianSerialDay" id="gregorianSerialDay">Gregorian Serial Day</a>
</h3>
<form name="gregorianSerialDayForm" action="javascript:return%20false;" id="gregorianSerialDayForm">
<table class="l" summary="">
<tr>
<td align="center"> <b>Gregorian serial day:</b>
<input type="text" name="day" value="" size="16" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcGregSerial();" /> </td>
</tr>
</table>
</form>
<br clear="left" />
<h3>
<a name="hebrewCalendar" id="hebrewCalendar">Hebrew Calendar</a>
</h3>
<form name="hebrewForm" action="javascript:return%20false;" id="hebrewForm">
<table class="l" summary="">
<tr>
<th>Date:</th>
<td align="center">
<input type="text" name="year" value="" size="5" />
<select name="month" size="1">
<option value="1">Nisan</option>
<option value="2">Iyyar</option>
<option value="3">Sivan</option>
<option value="4">Tammuz</option>
<option value="5">Av</option>
<option value="6">Elul</option>
<option value="7">Tishri</option>
<option value="8">Heshvan</option>
<option value="9">Kislev</option>
<option value="10">Teveth</option>
<option value="11">Shevat</option>
<option value="12">Adar</option>
<option value="13">Veadar</option>
</select>
<input type="text" name="day" value="" size="3" />
<br />
<input type="text" name="leap" value="" size="36" class="ctr" readonly="readonly" /> </td>
</tr>
<tr>
<th>Hebrew month:</th>
<td align="center">
<input type="text" name="hebmonth" size="10" alt="" id="hebmonth" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcHebrew();" /> </td>
</tr>
</table>
</form>
<p>The Hebrew (or Jewish) calendar attempts to simultaneously maintain alignment between the months and the seasons and synchronise months with the Moon—it is thus deemed a " <em>luni-solar calendar</em>". In addition, there are constraints
on which days of the week on which a year can begin and to shift otherwise required extra days to prior years to keep the length of the year within the prescribed bounds. This isn't easy, and the computations required are correspondingly intricate.</p>
<p>Years are classified as <em>common</em>(normal) or <em>embolismic</em>(leap) years which occur in a 19 year cycle in years 3, 6, 8, 11, 14, 17, and 19. In an embolismic (leap) year, an extra <em>month</em>of 29 days, "Veadar" or "Adar II",
is added to the end of the year after the month "Adar", which is designated "Adar I" in such years. Further, years may be <em>deficient</em>, <em>regular</em>, or <em>complete</em>, having respectively 353, 354, or 355 days
in a common year and 383, 384, or 385 days in embolismic years. Days are defined as beginning at sunset, and the calendar begins at sunset the night before Monday, October 7, 3761 <span class="bcad">B.C.E.</span>in the Julian calendar, or Julian
day 347995.5. Days are numbered with Sunday as day 1, through Saturday: day 7.</p>
<p>The average length of a month is 29.530594 days, extremely close to the mean <em>synodic month</em>(time from new Moon to next new Moon) of 29.530588 days. Such is the accuracy that more than 13,800 years elapse before a single day discrepancy between
the calendar's average reckoning of the start of months and the mean time of the new Moon. Alignment with the solar year is better than the Julian calendar, but inferior to the Gregorian. The average length of a year is 365.2468 days compared to
the actual solar tropical year (time from equinox to equinox) of 365.24219 days, so the calendar accumulates one day of error with respect to the solar year every 216 years.</p>
<br clear="left" />
<h3>
<a name="islamicCalendar" id="islamicCalendar">Islamic Calendar</a>
</h3>
<form name="islamicForm" action="javascript:return%20false;" id="islamicForm">
<table class="l" summary="">
<tr>
<th>Date:</th>
<td align="center">
<input type="text" name="year" value="" size="5" />
<select name="month" size="1">
<option value="1">Muharram</option>
<option value="2">Safar</option>
<option value="3">Rabi`al-Awwal</option>
<option value="4">Rabi`ath-Thani</option>
<option value="5">Jumada l-Ula</option>
<option value="6">Jumada t-Tania</option>
<option value="7">Rajab</option>
<option value="8">Sha`ban</option>
<option value="9">Ramadan</option>
<option value="10">Shawwal</option>
<option value="11">Dhu l-Qa`da</option>
<option value="12">Dhu l-Hijja</option>
</select>
<input type="text" name="day" value="" size="3" />
<br />
<input type="text" name="leap" value="" size="12" class="ctr" readonly="readonly" /> </td>
</tr>
<tr>
<th>Weekday:</th>
<td align="center">
<input type="text" name="wday" value="" size="18" class="ctr" readonly="readonly" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcIslamic();" /> </td>
</tr>
</table>
</form>
<p>The Islamic calendar is purely lunar and consists of twelve alternating months of 30 and 29 days, with the final 29 day month extended to 30 days during leap years. Leap years follow a 30 year cycle and occur in years 1, 5, 7, 10, 13, 16, 18, 21,
24, 26, and 29. Days are considered to begin at sunset. The calendar begins on Friday, July 16th, 622 <span class="bcad">C.E.</span>in the Julian calendar, Julian day 1948439.5, the day of Muhammad's flight from Mecca to Medina, with sunset on the
preceding day reckoned as the first day of the first month of year 1 A.H.—" <em lang="la" xml:lang="la">Anno Hegiræ</em>"—the Arabic word for "separate" or "go away". The names for the days are just
their numbers: Sunday is the first day and Saturday the seventh; the week is considered to begin on Saturday.</p>
<p>Each cycle of 30 years thus contains 19 normal years of 354 days and 11 leap years of 355, so the average length of a year is therefore ((19 × 354) + (11 × 355)) / 30 = 354.365... days, with a mean length of month of 1/12 this figure,
or 29.53055... days, which closely approximates the mean <em>synodic month</em>(time from new Moon to next new Moon) of 29.530588 days, with the calendar only slipping one day with respect to the Moon every 2525 years. Since the calendar is fixed
to the Moon, not the solar year, the months shift with respect to the seasons, with each month beginning about 11 days earlier in each successive solar year.</p>
<p>The calendar presented here is the most commonly used civil calendar in the Islamic world; for religious purposes months are defined to start with the first observation of the crescent of the new Moon.</p>
<br clear="left" />
<h3>
<a name="persianCalendar" id="persianCalendar">Persian Calendar</a>
</h3>
<form name="persianForm" action="javascript:return%20false;" id="persianForm">
<table class="l" summary="">
<tr>
<th>Date:</th>
<td align="center">
<input type="text" name="year" value="" size="5" />
<select name="month" size="1">
<option value="1">Farvardin</option>
<option value="2">Ordibehesht</option>
<option value="3">Khordad</option>
<option value="4">Tir</option>
<option value="5">Mordad</option>
<option value="6">Shahrivar</option>
<option value="7">Mehr</option>
<option value="8">Aban</option>
<option value="9">Azar</option>
<option value="10">Dey</option>
<option value="11">Bahman</option>
<option value="12">Esfand</option>
</select>
<input type="text" name="day" value="" size="3" />
<br />
<input type="text" name="leap" value="" size="12" class="ctr" readonly="readonly" /> </td>
</tr>
<tr>
<th>Weekday:</th>
<td align="center">
<input type="text" name="wday" value="" size="13" class="ctr" readonly="readonly" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcPersiana();" />
<!--
<input type="button" value="+" onclick="document.persianAstronomical.year.value++; calcPersiana();" />
-->
</td>
</tr>
</table>
</form>
<p>The modern Persian calendar was adopted in 1925, supplanting (while retaining the month names of) a traditional calendar dating from the eleventh century. The calendar consists of 12 months, the first six of which are 31 days, the next five 30 days,
and the final month 29 days in a normal year and 30 days in a leap year.</p>
<p>Each year begins on the day in which the March equinox occurs at or after solar noon at the reference longitude for Iran Standard Time (52°30' E). Days begin at midnight in the standard time zone. There is no leap year rule; 366 day years
do not recur in a regular pattern but instead occur whenever that number of days elapse between equinoxes at the reference meridian. The calendar therefore stays perfectly aligned with the seasons. No attempt is made to synchronise months with the
phases of the Moon.</p>
<p>There is some controversy about the reference meridian at which the equinox is determined in this calendar. Various sources cite Tehran, Esfahan, and the central meridian of Iran Standard Time as that where the equinox is determined; in this implementation,
the Iran Standard Time longitude is used, as it appears that this is the criterion used in Iran today. As this calendar is proleptic for all years prior to 1925  <span class="bcad">C.E.</span>, historical considerations regarding the capitals
of Persia and Iran do not seem to apply.</p>
<br clear="left" />
<div style="margin-left: 2em; padding-left: 12px; padding-right: 12px; background-color: #FFFFC0; color: inherit;">
<h4>
<a name="persianAstronomicalCalendar" id="persianAstronomicalCalendar">Persian Algorithmic Calendar</a>
</h4>
<form name="persianAstronomicalForm" action="javascript:return%20false;" id="persianAstronomicalForm">
<table class="r" summary="">
<tr>
<th>Date:</th>
<td align="center">
<input type="text" name="year" value="" size="5" />
<select name="month" size="1">
<option value="1">Farvardin</option>
<option value="2">Ordibehesht</option>
<option value="3">Khordad</option>
<option value="4">Tir</option>
<option value="5">Mordad</option>
<option value="6">Shahrivar</option>
<option value="7">Mehr</option>
<option value="8">Aban</option>
<option value="9">Azar</option>
<option value="10">Dey</option>
<option value="11">Bahman</option>
<option value="12">Esfand</option>
</select>
<input type="text" name="day" value="" size="3" />
<br />
<input type="text" name="leap" value="" size="12" class="ctr" readonly="readonly" /> </td>
</tr>
<tr>
<th>Weekday:</th>
<td align="center">
<input type="text" name="wday" value="" size="13" class="ctr" readonly="readonly" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcPersian();" /> </td>
</tr>
</table>
</form>
<p>Ahmad Birashk proposed an alternative means of determining leap years for the Persian calendar. His technique avoids the need to determine the moment of the astronomical equinox, replacing it with a very complex leap year structure. Years are grouped
into <em>cycles</em>which begin with four normal years after which every fourth subsequent year in the cycle is a leap year. Cycles are grouped into <em>grand cycles</em>of either 128 years (composed of cycles of 29, 33, 33, and 33 years) or 132
years, containing cycles of of 29, 33, 33, and 37 years. A <em>great grand cycle</em>is composed of 21 consecutive 128 year grand cycles and a final 132 grand cycle, for a total of 2820 years. The pattern of normal and leap years which began in
1925 will not repeat until the year 4745!</p>
<p> <b>This is
<em>not</em>the calendar in use in Iran!</b>It is presented here solely because there are many computer implementations of the Persian calendar which use it (with which users may wish to compare results), and because its baroque complexity enthralls
programmers like myself.</p>
<p>Each 2820 year great grand cycle contains 2137 normal years of 365 days and 683 leap years of 366 days, with the average year length over the great grand cycle of 365.24219852. So close is this to the actual solar tropical year of 365.24219878 days
that this calendar accumulates an error of one day only every 3.8 million years. As a purely solar calendar, months are not synchronised with the phases of the Moon.
<br clear="right" /> </p>
</div>
<h3>
<a name="mayanCalendar" id="mayanCalendar">Mayan Calendars</a>
</h3>
<form name="mayanCount" action="javascript:return%20false;" id="mayanCount">
<table class="l" summary="">
<tr>
<td align="center"> <b>Mayan Long Count</b>
<br />
<input type="text" name="baktun" value="" size="4" /> <b>.</b>
<input type="text" name="katun" value="" size="3" /> <b>.</b>
<input type="text" name="tun" value="" size="3" /> <b>.</b>
<input type="text" name="uinal" value="" size="3" /> <b>.</b>
<input type="text" name="kin" value="" size="3" /> <b>Haab:</b>  
<input type="text" name="haab" value="" size="9" class="ctr" readonly="readonly" />
<br /> <b>Tzolkin:</b>  
<input type="text" name="tzolkin" value="" size="10" class="ctr" readonly="readonly" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcMayanCount();" /> </td>
</tr>
</table>
</form>
<p>The Mayans employed three calendars, all organised as hierarchies of cycles of days of various lengths. The <em>Long Count</em>was the principal calendar for historical purposes, the <em>Haab</em>was used as the civil calendar, while the <em>Tzolkin</em>was
the religious calendar. All of the Mayan calendars are based on serial counting of days without means for synchronising the calendar to the Sun or Moon, although the Long Count and Haab calendars contain cycles of 360 and 365 days, respectively,
which are roughly comparable to the solar year. Based purely on counting days, the Long Count more closely resembles the Julian Day system and contemporary computer representations of date and time than other calendars devised in antiquity. Also
distinctly modern in appearance is that days and cycles count from zero, not one as in most other calendars, which simplifies the computation of dates, and that numbers as opposed to names were used for all of the cycles.</p>
<table class="r" summary="">
<tr>
<th>Cycle</th>
<th>Composed of</th>
<th>Total
<br />Days</th>
<th>Years
<br />(approx.)</th>
</tr>
<tr>
<td> <b>kin</b> </td>
<td> </td>
<td align="center">1</td>
<td> </td>
</tr>
<tr>
<td> <b>uinal</b> </td>
<td align="center">20 kin</td>
<td align="center">20</td>
<td align="center"> </td>
</tr>
<tr>
<td> <b>tun</b> </td>
<td align="center">18 uinal</td>
<td align="center">360</td>
<td align="center">0.986</td>
</tr>
<tr>
<td> <b>katun</b> </td>
<td align="center">20 tun</td>
<td align="center">7200</td>
<td align="center">19.7</td>
</tr>
<tr>
<td> <b>baktun</b> </td>
<td align="center">20 katun</td>
<td align="center">144,000</td>
<td align="center">394.3</td>
</tr>
<tr>
<td> <b>pictun</b> </td>
<td align="center">20 baktun</td>
<td align="center">2,880,000</td>
<td align="center">7,885</td>
</tr>
<tr>
<td> <b>calabtun</b> </td>
<td align="center">20 piktun</td>
<td align="center">57,600,000</td>
<td align="center">157,704</td>
</tr>
<tr>
<td> <b>kinchiltun</b> </td>
<td align="center">20 calabtun</td>
<td align="center">1,152,000,000</td>
<td align="center">3,154,071</td>
</tr>
<tr>
<td> <b>alautun</b> </td>
<td align="center">20 kinchiltun</td>
<td align="center">23,040,000,000</td>
<td align="center">63,081,429</td>
</tr>
</table>
<p>The Long Count calendar is organised into the hierarchy of cycles shown at the right. Each of the cycles is composed of 20 of the next shorter cycle with the exception of the <em>tun</em>, which consists of 18 <em>uinal</em>of 20 days each. This results
in a <em>tun</em>of 360 days, which maintains approximate alignment with the solar year over modest intervals—the calendar comes undone from the Sun 5 days every <em>tun</em>.</p>
<p>The Mayans believed at at the conclusion of each <em>pictun</em>cycle of about 7,885 years the universe is destroyed and re-created. Those with apocalyptic inclinations will be relieved to observe that the present cycle will not end until Columbus
Day, October 12, 4772 in the Gregorian calendar. Speaking of apocalyptic events, it's amusing to observe that the longest of the cycles in the Mayan calendar, <em>alautun</em>, about 63 million years, is comparable to the 65 million years since
the impact which brought down the curtain on the dinosaurs—an impact which occurred near the Yucatan peninsula where, almost an <em>alautun</em>later, the Mayan civilisation flourished. If the universe is going to be destroyed and the end
of the current <em>pictun</em>, there's no point in writing dates using the longer cycles, so we dispense with them here.</p>
<p>Dates in the Long Count calendar are written, by convention, as:</p>
<p class="c"> <em>baktun</em>  <b>.</b>  <em>katun</em>  <b>.</b>  <em>tun</em>  <b>.</b>  <em>uinal</em>  <b>.</b>  <em>kin</em></p>
<p>and thus resemble present-day Internet IP addresses!</p>
<p>For civil purposes the Mayans used the <em>Haab</em>calendar in which the year was divided into 18 named periods of 20 days each, followed by five <em>Uayeb</em>days not considered part of any period. Dates in this calendar are written as a day number
(0 to 19 for regular periods and 0 to 4 for the days of <em>Uayeb</em>) followed by the name of the period. This calendar has no concept of year numbers; it simply repeats at the end of the complete 365 day cycle. Consequently, it is not possible,
given a date in the Haab calendar, to determine the Long Count or year in other calendars. The 365 day cycle provides better alignment with the solar year than the 360 day <em>tun</em>of the Long Count but, lacking a leap year mechanism, the Haab
calendar shifted one day with respect to the seasons about every four years.</p>
<p>The Mayan religion employed the <em>Tzolkin</em>calendar, composed of 20 named periods of 13 days. Unlike the Haab calendar, in which the day numbers increment until the end of the period, at which time the next period name is used and the day count
reset to 0, the names and numbers in the Tzolkin calendar advance in parallel. On each successive day, the day number is incremented by 1, being reset to 0 upon reaching 13, and the next in the cycle of twenty names is affixed to it. Since 13 does
not evenly divide 20, there are thus a total of 260 day number and period names before the calendar repeats. As with the Haab calendar, cycles are not counted and one cannot, therefore, convert a Tzolkin date into a unique date in other calendars.
The 260 day cycle formed the basis for Mayan religious events and has no relation to the solar year or lunar month.</p>
<p>The Mayans frequently specified dates using <em>both</em>the Haab and Tzolkin calendars; dates of this form repeat only every 52 solar years.
<br clear="all" /> </p>
<!-- -->
<h3>
<a name="bahaiCalendar" id="bahaiCalendar">Bahá'í Calendar</a>
</h3>
<form name="bahaiForm" action="javascript:return%20false;" id="bahaiForm">
<table class="l" summary="">
<tr>
<th>Date:</th>
<td align="center">Kull-i-Shay: 
<input type="text" name="kull_i_shay" value="" size="3" />    Váhid: 
<input type="text" name="vahid" value="" size="3" />
<br />Year: 
<select name="year" size="1">
<option value="1">Alif</option>
<option value="2">Bá'</option>
<option value="3">Ab</option>
<option value="4">Dál</option>
<option value="5">Báb</option>
<option value="6">Váv</option>
<option value="7">Abad</option>
<option value="8">Jád</option>
<option value="9">Bahá</option>
<option value="10">Hubb</option>
<option value="11">Bahháj</option>
<option value="12">Javáb</option>
<option value="13">Ahad</option>
<option value="14">Vahháb</option>
<option value="15">Vidád</option>
<option value="16">Badí'</option>
<option value="17">Bahí</option>
<option value="18">Abhá</option>
<option value="19">Vahíd</option>
</select>
<br />Month: 
<select name="month" size="1">
<option value="1">Bahá</option>
<option value="2">Jalál</option>
<option value="3">Jamál</option>
<option value="4">`Azamat</option>
<option value="5">Núr</option>
<option value="6">Rahmat</option>
<option value="7">Kalimát</option>
<option value="8">Kamál</option>
<option value="9">Asmá'</option>
<option value="10">`Izzat</option>
<option value="11">Mashíyyat</option>
<option value="12">`Ilm</option>
<option value="13">Qudrat</option>
<option value="14">Qawl</option>
<option value="15">Masáil</option>
<option value="16">Sharaf</option>
<option value="17">Sultán</option>
<option value="18">Mulk</option>
<option value="19">Ayyám-i-Há</option>
<option value="20">`Alá'</option>
</select>
<br />Day: 
<select name="day" size="1">
<option value="1">Bahá</option>
<option value="2">Jalál</option>
<option value="3">Jamál</option>
<option value="4">`Azamat</option>
<option value="5">Núr</option>
<option value="6">Rahmat</option>
<option value="7">Kalimát</option>
<option value="8">Kamál</option>
<option value="9">Asmá'</option>
<option value="10">`Izzat</option>
<option value="11">Mashíyyat</option>
<option value="12">`Ilm</option>
<option value="13">Qudrat</option>
<option value="14">Qawl</option>
<option value="15">Masáil</option>
<option value="16">Sharaf</option>
<option value="17">Sultán</option>
<option value="18">Mulk</option>
<option value="19">`Alá'</option>
</select>
<br />Weekday:  
<input type="text" name="weekday" value="" size="9" class="ctr" readonly="readonly" />
<br />
<input type="text" name="leap" value="" size="12" class="ctr" readonly="readonly" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcBahai();" /> </td>
</tr>
</table>
</form>
<p>The Bahá'í calendar is a solar calendar organised as a hierarchy of cycles, each of length 19, commemorating the 19 year period between the 1844 proclamation of the Báb in <a href="/images/eclipse99/iranimages.html#Shiraz" target="_blank">
Shiraz</a>and the revelation by Bahá'u'lláh in 1863. Days are named in a cycle of 19 names. Nineteen of these cycles of 19 days, usually called "months" even though they have nothing whatsoever to do with the Moon, make up a
year, with a period between the 18th and 19th months referred to as <em>Ayyám-i-Há</em>not considered part of any month; this period is four days in normal years and five days in leap years. The rule for leap years is identical to
that of the Gregorian calendar, so the Bahá'í calendar shares its accuracy and remains synchronised. The same cycle of 19 names is used for days and months.</p>
<p>The year begins at the equinox, March 21, the Feast of Naw-Rúz; days begin at sunset. Years have their own cycle of 19 names, called the <em>Váhid</em>. Successive cycles of 19 years are numbered, with cycle 1 commencing on March 21,
1844, the year in which the Báb announced his prophecy. Cycles, in turn, are assembled into <em>Kull-I-Shay</em>super-cycles of 361 (19²) years. The first <em>Kull-I-Shay</em>will not end until Gregorian calendar year 2205. A week of
seven days is superimposed on the calendar, with the week considered to begin on Saturday. Confusingly, three of the names of weekdays are identical to names in the 19 name cycles for days and months.</p>
<br clear="left" />
<!-- -->
<h3>
<a name="indianCivilCalendar" id="indianCivilCalendar">Indian Civil Calendar</a>
</h3>
<form name="indianCivilForm" action="javascript:return%20false;" id="indianCivilForm">
<table class="l" summary="">
<tr>
<th>Date:</th>
<td align="center">
<input type="text" name="year" value="" size="5" />
<select name="month" size="1">
<option value="1">Caitra</option>
<option value="2">Vaisakha</option>
<option value="3">Jyaistha</option>
<option value="4">Asadha</option>
<option value="5">Sravana</option>
<option value="6">Bhadra</option>
<option value="7">Asvina</option>
<option value="8">Kartika</option>
<option value="9">Agrahayana</option>
<option value="10">Pausa</option>
<option value="11">Magha</option>
<option value="12">Phalguna</option>
</select>
<input type="text" name="day" value="" size="3" />
<br />Weekday:
<input type="text" name="weekday" value="" size="15" class="ctr" readonly="readonly" />
<br />
<input type="text" name="leap" value="" size="12" class="ctr" readonly="readonly" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcIndianCivilCalendar();" /> </td>
</tr>
</table>
</form>
<p>A bewildering variety of calendars have been and continue to be used in the Indian subcontinent. In 1957 the Indian government's Calendar Reform Committee adopted the National Calendar of India for civil purposes and, in addition, defined guidelines
to standardise computation of the religious calendar, which is based on astronomical observations. The civil calendar is used throughout India today for administrative purposes, but a variety of religious calendars remain in use. We present the
civil calendar here.</p>
<p>The National Calendar of India is composed of 12 months. The first month, <em>Caitra</em>, is 30 days in normal and 31 days in leap years. This is followed by five consecutive 31 day months, then six 30 day months. Leap years in the Indian calendar
occur in the same years as as in the Gregorian calendar; the two calendars thus have identical accuracy and remain synchronised.</p>
<p>Years in the Indian calendar are counted from the start of the Saka Era, the equinox of March 22nd of year 79 in the Gregorian calendar, designated day 1 of month Caitra of year 1 in the Saka Era. The calendar was officially adopted on 1 Caitra, 1879
Saka Era, or March 22nd, 1957 Gregorian. Since year 1 of the Indian calendar differs from year 1 of the Gregorian, to determine whether a year in the Indian calendar is a leap year, add 78 to the year of the Saka era then apply the Gregorian calendar
rule to the sum.</p>
<br clear="left" />
<h3>
<a name="frenchRepublicanCalendar" id="frenchRepublicanCalendar">French Republican Calendar</a>
</h3>
<form name="frenchRepublicanForm" action="javascript:return%20false;" id="frenchRepublicanForm">
<table class="l" summary="">
<tr>
<th>Date:</th>
<td align="center">Année
<input type="text" name="an" value="" size="5" />de la République
<br />Mois de
<select name="mois" size="1">
<option value="1">Vendémiaire</option>
<option value="2">Brumaire</option>
<option value="3">Frimaire</option>
<option value="4">Nivôse</option>
<option value="5">Pluviôse</option>
<option value="6">Ventôse</option>
<option value="7">Germinal</option>
<option value="8">Floréal</option>
<option value="9">Prairial</option>
<option value="10">Messidor</option>
<option value="11">Thermidor</option>
<option value="12">Fructidor</option>
<option value="13">(Sans-culottides)</option>
</select>
<br />Décade
<select name="decade" size="1">
<option value="1">I</option>
<option value="2">II</option>
<option value="3">III</option>
</select>Jour
<select name="jour" size="1">
<option value="1">du Primidi (1)</option>
<option value="2">du Duodi (2)</option>
<option value="3">du Tridi (3)</option>
<option value="4">du Quartidi (4)</option>
<option value="5">du Quintidi (5)</option>
<option value="6">du Sextidi (6)</option>
<option value="7">du Septidi (7)</option>
<option value="8">du Octid (8)i</option>
<option value="9">du Nonidi (9)</option>
<option value="10">du Décadi (10)</option>
<option value="11">------------</option>
<option value="12">de la Vertu (1)</option>
<option value="13">du Génie (2)</option>
<option value="14">du Travail (3)</option>
<option value="15">de l'Opinion (4)</option>
<option value="16">des Récompenses (5)</option>
<option value="17">de la Révolution (6)</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcFrench();" /> </td>
</tr>
</table>
</form>
<p>The French Republican calendar was adopted by a <a href="fr_decret.html" target="_blank">decree</a>of <em lang="fr" xml:lang="fr">La Convention Nationale</em>on Gregorian date October 5, 1793 and went into effect the following November 24th, on which
day Fabre d'églantine proposed to the <em lang="fr" xml:lang="fr">Convention</em>the names for the months. It incarnates the revolutionary spirit of "Out with the old! In with the relentlessly rational!" which later gave rise in
1795 to the metric system of weights and measures which has proven more durable than the Republican calendar.</p>
<p>The calendar consists of 12 months of 30 days each, followed by a five- or six-day holiday period, the <em lang="fr" xml:lang="fr">jours complémentaires</em>or <em lang="fr" xml:lang="fr">sans-culottides</em>. Months are grouped into four seasons;
the three months of each season end with the same letters and rhyme with one another. The calendar begins on Gregorian date September 22nd, 1792, the September equinox and date of the founding of the First Republic. This day is designated the first
day of the month of Vendémiaire in year 1 of the Republic. Subsequent years begin on the day in which the September equinox occurs as reckoned at the Paris meridian. Days begin at true solar midnight. Whether the <em lang="fr" xml:lang="fr">sans-culottides</em>period
contains five or six days depends on the actual date of the equinox. Consequently, there is no leap year rule <em lang="la" xml:lang="la">per se</em>: 366 day years do not recur in a regular pattern but instead follow the dictates of astronomy.
The calendar therefore stays perfectly aligned with the seasons. No attempt is made to synchronise months with the phases of the Moon.</p>
<p>The Republican calendar is rare in that it has no concept of a seven day week. Each thirty day month is divided into three <em lang="fr" xml:lang="fr">décades</em>of ten days each, the last of which, <em lang="fr" xml:lang="fr">décadi</em>,
was the day of rest. (The word " <em lang="fr" xml:lang="fr">décade</em>" may confuse English speakers; the French noun denoting ten years is " <em lang="fr" xml:lang="fr">décennie</em>".) The names of days in the
<em lang="fr" xml:lang="fr">décade</em>are derived from their number in the ten day sequence. The five or six days of the <em lang="fr" xml:lang="fr">sans-culottides</em>do not bear the names of the <em lang="fr" xml:lang="fr">décade</em>.
Instead, each of these holidays commemorates an aspect of the republican spirit. The last, <em lang="fr" xml:lang="fr">jour de la Révolution</em>, occurs only in years of 366 days.</p>
<p>Napoléon abolished the Republican calendar in favour of the Gregorian on January 1st, 1806. Thus France, one of the first countries to adopt the Gregorian calendar (in December 1582), became the only country to subsequently abandon and then
re-adopt it. During the period of the Paris Commune uprising in 1871 the Republican calendar was again briefly used.</p>
<p>The <a href="fr_decret.html" target="_blank">original decree</a>which established the Republican calendar contained a contradiction: it defined the year as starting on the day of the true autumnal equinox in Paris, but further prescribed a four year
cycle called <em lang="fr" xml:lang="fr">la Franciade</em>, the fourth year of which would end with <em lang="fr" xml:lang="fr">le jour de la Révolution</em>and hence contain 366 days. These two specifications are incompatible, as 366 day
years defined by the equinox do not recur on a regular four year schedule. This problem was recognised shortly after the calendar was proclaimed, but the calendar was abandoned five years before the first conflict would have occurred and the issue
was never formally resolved. Here we assume the equinox rule prevails, as a rigid four year cycle would be no more accurate than the Julian calendar, which couldn't possibly be the intent of its enlightened Republican designers.
<br clear="left"
/> </p>
<h3>
<a name="iso8601week" id="iso8601week">ISO-8601 Week and Day, and Day of Year</a>
</h3>
<form name="iso8601WeekForm" action="javascript:return%20false;" id="iso8601WeekForm">
<table class="l" summary="">
<tr>
<td align="center">Day
<input type="text" name="day" value="" size="3" />of week
<input type="text" name="week" value="" size="3" />of year
<input type="text" name="year" value="" size="5" /> </td>
</tr>
<tr>
<td align="center">
<input type="button" value="Calculate" onclick="calcIsoWeek();" /> </td>
</tr>
</table>
</form>
<p>The <a href="http://www.iso.ch/" target="_blank">International Standards
Organisation</a>(ISO) issued Standard ISO 8601, "Representation of Dates" in 1988, superseding the earlier ISO 2015. The bulk of the standard consists of standards for representing dates in the Gregorian calendar including the highly recommended
" <b>YYYY-MM-DD</b>" form which is unambiguous, free of cultural bias, can be sorted into order without rearrangement, and is Y9K compliant. In addition, ISO 8601 formally defines the "calendar week" often encountered in commercial
transactions in Europe. The first calendar week of a year: week 1, is that week which contains the first Thursday of the year (or, equivalently, the week which includes January 4th of the year; the first day of that week is the previous Monday).
The last week: week 52 or 53 depending on the date of Monday in the first week, is that which contains December 28th of the year. The first ISO calendar week of a given year starts with a Monday which can be as early as December 29th of the previous
year or as late as January 4th of the present; the last calendar week can end as late as Sunday, January 3rd of the subsequent year. ISO 8601 dates in year, week, and day form are written with a "W" preceding the week number, which bears
a leading zero if less than 10, for example February 29th, 2000 is written as 2000-02-29 in year, month, day format and 2000-W09-2 in year, week, day form; since the day number can never exceed 7, only a single digit is required. The hyphens may
be elided for brevity and the day number omitted if not required. You will frequently see date of manufacture codes such as "00W09" stamped on products; this is an abbreviation of 2000-W09, the ninth week of year 2000.</p>
<br clear="left"
/>
<form name="isoDay" action="javascript:return%20false;" id="isoDay">
<table class="l" summary="">
<tr>
<td align="center">Day
<input type="text" name="day" value="" size="3" />of year
<input type="text" name="year" value="" size="5" /> </td>
</tr>
<tr>
<td align="center">
<input type="button" value="Calculate" onclick="calcIsoDay();" /> </td>
</tr>
</table>
</form>
<p>In solar calendars such as the Gregorian, only days and years have physical significance: days are defined by the rotation of the Earth, and years by its orbit about the Sun. Months, decoupled from the phases of the Moon, are but a memory of forgotten
lunar calendars, while weeks of seven days are entirely a social construct—while most calendars in use today adopt a cycle of seven day names or numbers, calendars with name cycles ranging from four to sixty days have been used by other cultures
in history.</p>
<p>ISO 8601 permits us to jettison the historical and cultural baggage of weeks and months and express a date simply by the year and day number within that year, ranging from 001 for January 1st through 365 (366 in a leap year) for December 31st. This
format makes it easy to do arithmetic with dates within a year, and only slightly more complicated for periods which span year boundaries. You'll see this representation used in project planning and for specifying delivery dates. ISO dates in this
form are written as " <b>YYYY-DDD</b>", for example 2000-060 for February 29th, 2000; leading zeroes are always written in the day number, but the hyphen may be omitted for brevity.</p>
<p>All ISO 8601 date formats have the advantages of being fixed length (at least until the Y10K crisis rolls around) and, when stored in a computer, of being sorted in date order by an alphanumeric sort of their textual representations. The ISO week
and day and day of year calendars are derivative of the Gregorian calendar and share its accuracy.</p>
<br clear="left" />
<h3>
<a name="unixTime" id="unixTime">Unix <tt>time()</tt>value</a>
</h3>
<form name="unixTimeForm" action="javascript:return%20false;" id="unixTimeForm">
<table class="l" summary="">
<tr>
<td align="center"> <b>Unix time() value:</b>
<input type="text" name="time" value="" size="14" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcUnixTime();" /> </td>
</tr>
</table>
</form>
<p>Development of the Unix operating system began at Bell Laboratories in 1969 by Dennis Ritchie and Ken Thompson, with the first PDP-11 version becoming operational in February 1971. Unix wisely adopted the convention that all internal dates and times
(for example, the time of creation and last modification of files) were kept in Universal Time, and converted to local time based on a per-user time zone specification. This far-sighted choice has made it vastly easier to integrate Unix systems
into far-flung networks without a chaos of conflicting time settings.</p>
<p>Many machines on which Unix was initially widely deployed could not support arithmetic on integers longer than 32 bits without costly multiple-precision computation in software. The internal representation of time was therefore chosen to be the number
of seconds elapsed since 00:00 Universal time on January 1, 1970 in the Gregorian calendar (Julian day 2440587.5), with time stored as a 32 bit signed integer ( <tt>long</tt>in early C implementations).</p>
<p>The influence of Unix time representation has spread well beyond Unix since most C and C++ libraries on other systems provide Unix-compatible time and date functions. The major drawback of Unix time representation is that, if kept as a 32 bit signed
quantity, on January 19, 2038 it will go negative, resulting in chaos in programs unprepared for this. Unix and C implementations wisely (for reasons described below) define the result of the <tt>time()</tt>function as type <tt>time_t</tt>, which
leaves the door open for remediation (by changing the definition to a 64 bit integer, for example) before the clock ticks the dreaded doomsday second.</p>
<p>C compilers on Unix systems prior to 7th Edition lacked the 32-bit <tt>long</tt>type. On earlier systems <tt>time_t</tt>, the value returned by the <tt>time()</tt>function, was an array of two 16-bit <tt>int</tt>s which, concatenated, represented
the 32-bit value. This is the reason why <tt>time()</tt>accepts a pointer argument to the result (prior to 7th Edition it returned a status, not the 32-bit time) and <tt>ctime()</tt>requires a pointer to its input argument. Thanks to Eric Allman
(author of <tt>sendmail</tt>) for pointing out these historical nuggets.</p>
<br clear="left" />
<h3>
<a name="excelSerial1900" id="excelSerial1900">Excel Serial Day Number</a>
</h3>
<form name="excelSerial1900Form" action="javascript:return%20false;" id="excelSerial1900Form">
<table class="l" summary="">
<tr>
<td align="center"> <b>
<font size="+1">1900 Date System (PC)</font>
</b>
<br /> <b>Excel serial day:</b>
<input type="text" name="day" value="" size="16" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcExcelSerial1900();" /> </td>
</tr>
</table>
</form>
<p>Spreadsheet calculations frequently need to do arithmetic with date and time quantities—for example, calculating the interest on a loan with a given term. When Microsoft Excel was introduced for the PC Windows platform, it defined dates and
times as "serial values", which express dates and times as the number of days elapsed since midnight on January 1, 1900 with time given as a fraction of a day. Midnight on January 1, 1900 is day 1.0 in this scheme. Time zone is unspecified
in Excel dates, with the <tt>NOW()</tt>function returning whatever the computer's clock is set to—in most cases local time, so when combining data from machines in different time zones you usually need to add or subtract the bias, which can
differ over the year due to observance of summer time. Here we assume Excel dates represent Universal (Greenwich Mean) time, since there isn't any other rational choice. But don't assume you can always get away with this.</p>
<p>You'd be entitled to think, therefore, that conversion back and forth between PC Excel serial values and Julian day numbers would simply be a matter of adding or subtracting the Julian day number of December 31, 1899 (since the PC Excel days are numbered
from 1). But this is a <em>Microsoft</em>calendar, remember, so one must first look to make sure it doesn't contain one of those bonehead blunders characteristic of Microsoft. As is usually the case, one doesn't have to look very far. If you have
a copy of PC Excel, fire it up, format a cell as containing a date, and type 60 into it: out pops "February 29, 1900". News apparently travels <em>very</em>slowly from Rome to Redmond—ever since Pope Gregory <a href="IG_Latin.html"
target="_blank">revised the calendar</a>in 1582, years divisible by 100 have <em>not</em>been leap years, and consequently the year 1900 contained no February 29th. Due to this morsel of information having been lost somewhere between the Holy See
and the <a href="/documents/top10.html">Infernal</a>Seattle monopoly, all Excel day numbers for days subsequent to February 28th, 1900 are one day greater than the actual day count from January 1, 1900. Further, note that any computation of the
number of days in a period which begins in January or February 1900 and ends in a subsequent month will be off by one—the day count will be one greater than the actual number of days elapsed.</p>
<p>By the time the 1900 blunder was discovered, Excel users had created millions of spreadsheets containing incorrect day numbers, so Microsoft decided to leave the error in place rather than force users to convert their spreadsheets, and the error remains
to this day. Note, however, that <em>only 1900</em>is affected; while the first release of Excel probably also screwed up all years divisible by 100 and hence implemented a purely Julian calendar, contemporary versions do correctly count days in
2000 (which is a leap year, being divisible by 400), 2100, and subsequent end of century years.</p>
<p>PC Excel day numbers are valid only between 1 (January 1, 1900) and 2958465 (December 31, 9999). Although a serial day counting scheme has no difficulty coping with arbitrary date ranges or days before the start of the epoch (given sufficient precision
in the representation of numbers), Excel doesn't do so. Day 0 is deemed the idiotic January 0, 1900 (at least in Excel 97), and negative days and those in Y10K and beyond are not handled at all. Further, old versions of Excel did date arithmetic
using 16 bit quantities and did not support day numbers greater than 65380 (December 31, 2078); I do not know in which release of Excel this limitation was remedied.</p>
<br clear="left" />
<a name="excelSerial1904" id="excelSerial1904"></a>
<form name="excelSerial1904Form" action="javascript:return%20false;" id="excelSerial1904Form">
<table class="l" summary="">
<tr>
<td align="center"> <b>
<font size="+1">1904 Date System (Macintosh)</font>
</b>
<br /> <b>Excel serial day:</b>
<input type="text" name="day" value="" size="16" /> </td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="button" value="Calculate" onclick="calcExcelSerial1904();" /> </td>
</tr>
</table>
</form>
<p>Having saddled every PC Excel user with a defective date numbering scheme wasn't enough for Microsoft—nothing ever is. Next, they proceeded to come out with a Macintosh version of Excel which uses an <em>entirely different</em>day numbering
system based on the MacOS native time format which counts days elapsed since January 1, 1904. To further obfuscate matters, on the Macintosh they chose to number days from zero rather than 1, so midnight on January 1, 1904 has serial value 0.0.
By starting in 1904, they avoided screwing up 1900 as they did on the PC. So now Excel users who interchange data have to cope with two incompatible schemes for counting days, one of which thinks 1900 was a leap year and the other which doesn't
go back that far. To compound the fun, you can now select either date system on either platform, so you can't be certain dates are compatible even when receiving data from another user with same kind of machine you're using. I'm sure this was all
done in the interest of the "efficiency" of which Microsoft is so fond. As we all know, it would take a computer <em>almost forever</em>to add or subtract four in order to make everything seamlessly interchangeable.</p>
<p>Macintosh Excel day numbers are valid only between 0 (January 1, 1904) and 2957003 (December 31, 9999). Although a serial day counting scheme has no difficulty coping with arbitrary date ranges or days before the start of the epoch (given sufficient
precision in the representation of numbers), Excel doesn't do so. Negative days and those in Y10K and beyond are not handled at all. Further, old versions of Excel did date arithmetic using 16 bit quantities and did not support day numbers greater
than 63918 (December 31, 2078); I do not know in which release of Excel this limitation was remedied.</p>
<br clear="left" />
<script type="text/javascript" language="JavaScript">
// <![CDATA[
<!--
if (location.search != "") {
presetDataToRequest(location.search.substring(1));
} else {
calcGregorian(); // Calculate today's values in other calendars
}
// -->
//]]>
</script>
<h3>References</h3>
<table class="a" summary="">
<tr>
<td bgcolor="#e0e0e0" align="center"> <font face="Arial, Helvetica, sans-serif" size="-1">Click on titles to
order books on-line from
<br />
<a href="http://www.amazon.com/exec/obidos/redirect-home/fourmilabwwwfour" target="Amazon_Fourmilab">
<img src="/images/icons/amazon.gif" vspace="3" width="90" height="29" border="0" alt="Amazon.com." />
</a></font> </td>
</tr>
</table>
<dl> <dt>Meeus, Jean.
<cite>
<a href="http://www.amazon.com/exec/obidos/ASIN/0943396611/fourmilabwwwfour"
target="Amazon_Fourmilab">Astronomical Algorithms</a>
</cite>2nd ed. Richmond: Willmann-Bell, 1998. ISBN 0943396-61-1.</dt>
<dd>The essential reference for computational positional astronomy.</dd> <dt>P. Kenneth Seidelmann (ed.)
<cite>
<a href="http://www.amazon.com/exec/obidos/ASIN/1891389459/fourmilabwwwfour"
target="Amazon_Fourmilab">Explanatory Supplement to the Astronomical
Almanac</a>
</cite>. Sausalito CA: University Science Books, [1992] 2005. ISBN 1-891389-45-9.</dt>
<dd>Authoritative reference on a wealth of topics related to computational geodesy and astronomy. Various calendars are described in depth, including techniques for interconversion.</dd> <dt>The
<a href="http://www.imcce.fr/imcce_en.html" target="_blank">Institut de
mécanique céleste et de calcul des éphémérides</a>in Paris provides
excellent on-line descriptions of a variety of
<a href="http://www.imcce.fr/page.php?nav=fr/ephemerides/astronomie/Promenade/pages2/277.html"
target="_blank">calendars</a>.</dt> </dl>
<br clear="right" />
<hr />
<table align="right" summary="">
<tr>
<td align="center">
<form name="feedback" method="post" action="/cgi-bin/FeedbackForm.pl" id="feedback">
<input type="hidden" name="pagetitle" value="<cite>Calendar Converter</cite>" />
<input type="hidden" name="backlink" value="Back to <cite>Calendar Converter</cite>" />
<input type="submit" value=" Send Feedback " /> </form>
</td>
</tr>
<tr>
<td align="center">
<a href="http://validator.w3.org/check?uri=http://www.fourmilab.ch/documents/calendar/index.html" target="FourmilabValidation"> <img src="/images/icons/valid-xhtml10.png" alt="Valid XHTML 1.0" height="31" width="88" border="0" /> </a>
</td>
</tr>
</table> <address>by
<a href="/">John Walker</a>
<br />September, MMXV</address>
<center> <em>This document is in the public domain.</em> </center>
</body>
</html>