DreamCalc tm
Home Download Buy Now Support
User Guide: Contents Page Index of Functions

| # Calculating with Dates
> DreamCalc supports date input and date arithmetic. For a complete list of the date functions available, see Date Functions. ## Date Input Use the [DATE] key to enter a date (time is optional). For most users, the date format will automatically be set to their preferred notation. Otherwise it will default to Month-Day-Year (M-D-Y). In the following examples, it is assumed the M-D-Y format is used. Example : Date Input Only. Key in:
>     2 [DATE] 18 [DATE] 2010 (Feb 18, 2010)
>     [ENTER]
>     Displays: 733821 (day number)
> Example : Date and Time Input. Key in:
>     2 [DATE] 18 [DATE] 2010 [DATE] 7 [DATE] 50 (Feb 18, 2010 +07:50)
>     [ENTER]
>     Displays: 733821.326388888889 (day number)
> In the examples above, it can be seen that when a date is entered, it gets converted to a "day number"—a decimal value representing the number of days since a zero reference day in the past. A numerical value of 1.5, therefore, represents one day and 12 hours since the zero day. In practice most users will never have to be concerned with the day numbers because the [DATE] key can be used to display the result of any date calculation in a natural date/time style (below). Example : Date Display.
>     733822.5 (day number with half a day)
>     [ENTER]
>     Displays: 733822.5

>     [DATE]
>     Displays: 02/19/2010 +12:00:00
> By default, the DreamCalc zero day is defined by the Rata Die Calendar, but is configurable. See the following sections for additional information on day numbers. ## Examples of Date Arithmetic Example : How many days are there between June 29th, 1972 and February 18th, 2008? We can simply subtract the dates. Key in:
>     2 [DATE] 18 [DATE] 2008 (Feb 18, 2008)
>     [-]
>     6 [DATE] 29 [DATE] 1972 (June 29, 1972)
>     [ENTER]
>     Displays: 13017
> If you wish, you may also input two digit years and DreamCalc will convert them accordingly. Example: What date will it be in 321 days from now? For this, we can use the TODAY function which you will find on the numerical keypad, as follows:
>     [TODAY] (today's date & time from PC clock)
>     [+]
>     321
>     [ENTER]
>     Displays: 732306.3899... (depends on current time)
> The display will shows a numerical value which represents the answer. Simply press the [DATE] key again to convert it to a meaningful date and time, i.e.:
>     Displays: 732306.3899... (from above)
>     [DATE]
>     Displays: 12/26/2005 +09:21:32.
> Converting values to date representations does not change the underlying value. If you now to press [ENTER], the date above will be shown as the numerical value once again. Note. Date arithmetic does not adjust for daylight saving. ### Day of Week Example On the numerical keys, you will find a range of calendar functions. In this introductory example, we'll use the DOW (day of week) function. Example: What day will it be on March 17th, 2029?
>     [DOW]
>     3 [DATE] 17 [DATE] 2029 (March 17, 2029)
>     [ENTER]
>     Displays: 6 (sat)
Note. The above example assumes prefix algebraic input. If you are using CAL or RPN, simply hit [DOW] after entering the date. With week days, 1 is always Monday. Therefore the value of 6 represents Saturday. The value for Sunday may be either 0 or 7, depending up your setting for the first day of the week. You can change this from the Options Window. ## Calendar Concepts ### Day Numbers You should note that in the above examples that we were never too concerned with the actual numerical date value. We simply used the [DATE] key to convert. If you don't care about the actual numerical value, this is all you need to do. However, in some fields, knowledge of the underlying date value is important. In fact, there are a number of commonly used day number calendar systems. By default, DreamCalc uses the Rata Die calendar, but this may easily be changed to any one of the following:
Calendar Name (Abbrev.) | Zero Day* | Typical Applications
--- | --- | ---
ANSI/ISO (AS) | 01/01/1601 AD. +00:00 | Programming.
Julian (JD) | 11/24/4714 BC. +12:00 (Noon) | Astronomical, Historical, General Purpose.
Modified Julian (MJ) | 11/17/1858 AD. +00:00 | Satellite Orbital Analysis.
Rata Die (RD) | 12/31/0001 BC. +00:00 | Historical, General Purpose.
UNX 1970 (UX) | 01/01/1970 AD. +00:00 | Programming. UNIX. C Language.
WIN 1899 (WN) | 12/30/1899 AD. +12:00 (Noon) | Programming. Microsoft™ & Borland™ APIs (equivalent to Borland's TDateTime values).
*Dates are given in the Proleptic Gregorian Calendar. Explained below. Functions which accept date input values take into account the Day Calendar setting, so unless you explicitly need knowledge of the actual value, it is completely transparent. Note. There is one situation where you should take care however. If you were to store a date value in memory and then change day calendar mode, when the value is recalled it will subsequently no-longer equate to the same date. ### Proleptic Gregorian Calendar DreamCalc uses the Gregorian Calendar, which is the one used through-out the Western World in modern times. The term "Proleptic" is used to refer to the principle of applying this calendar system to historical times prior to its existence. If you are using DreamCalc for dates in the 20th and 21st Centuries, this is not something you need be concerned about. ### Entering Historical Dates Dates prior to 1 AD. will be shown using the "BC." abbreviation. Press the [+/(-)] key to enter dates prior to 1 AD. by using it to toggle the year between BC. or AD during date entry. This should be done only when keying in the year number, not day or month values. You should generally take care using the [+/(-)] key, as changing the sign of an underlying numerical day value does not equate to the same thing as pressing it during date with the [DATE] key. If you have the two digit conversion feature enabled, you should also take care entering two digit years. If you enter just 79, for example, you will find that this is automatically converted to 1979 unless explicitly input the leading zeros or turn two digit year conversions off. Note. Entry of a zero year value is disallowed, as there is no year zero in the Gregorian Calendar (1 BC. is followed by 1 AD.). See also: Date Functions |