Date formats
Date and date-time values are displayed using the format shown when Date is selected. A date- number is a numeric value representing the number of days since the date origin, usually Jan 1, 1904. The fractional part, if any, represents the time-of-day as a fraction of a 24-hour day. Analytica distinguishes between real numbers and date-time numbers, so that if real numbers and dates appear in the same table, the dates will be shown as dates, the real numbers in the current numeric format. When you are viewing the Date format settings, the format used for numeric values remains italicized.
The Date format in the Number format dialog offers these options:
- Short: e.g., 7/15/2011
- Abbrev: e.g., 15-Jul-2011
- Long: e.g., Thursday, July 15, 2011
- Time: e.g., 2:05:06 PM
- Full: e.g., 15-July-2011 2:05:06 PM
Custom: Select an existing custom format from the menu, or type in a new one, for example:
Date format Display as dd-MM-yy 05-08-08 'Q'Q YYYY Q2 2008 www, d MMM yyyy Thu, 5 Aug 2008 www, d of MMMM, yyyy Thursday, 5 of August, 2008 d-MMM-yyyy hh:mm:ss tt 5-Aug-2008 03:45:22 PM MM/dd/yy H:m:s 08/05/08 15:45:22
Date format codes: Custom date format uses these letter codes, conventional for Microsoft Windows.
Code Description Example d
numeric day of the month as one digit 1, 2, … 31 dd
numeric day of the month as two digits 01, 02, … 31 ddd
ordinal day of month in numeric format 1st, 2nd, … 31st dddd
ordinal day of month in text format first, second, … thirty-first Dddd
capitalized ordinal day of month First, Second, … Thirty-first www
weekday in three letters Mon, Tue, ... Sun wwww
weekday in full Monday, Tuesday, … Sunday M
month as a number 1, 2, … 12 MM
month as two-digit number 01, 02, …12 MMM
month as three letter name Jan, Feb, … Dec MMMM
month as full name January, February, … December q
quarter as one digit 1, 2, 3, 4 yy
year as two digits e.g., 99, 00, 01 yyyy
year as four digits e.g., 1999, 2000, 2001 h
hour on a 12-hour clock 1, 2, ... 12 H
hour on a 24-hour clock 0, 1, ..., 23 hh
hour on a 12-hour clock as two digits 01, 02, ... 12 HH
hour on a 24-hour clock as two digits 00, 01, ... 23 m
minutes 0, 1, ... 59 mm
minutes as two digits 0, 1, ... 59 s
seconds 0, 1, ... 59 ss
seconds as two digits 00, 01, ... 59 tt
AM or PM AM, PM
Date format codes: Custom date format uses these letter codes, conventional for Microsoft Windows.
Interpreting input dates: A value entered into a definition, input control, or table cell, is interpreted as a date (or time) when the entire expression can be interpreted as a date or time. For example, 1/5/2012
and 1-5-2012
are interpreted as 5 January, 2012
on a computer set to USA region or 1 May, 2012
elsewhere. It recognizes most common formats for dates and times.
Within a sub-expression, the only date format it recognizes is d-MMM-yyyy
, where the month is the three-letter English month name, e.g., 1-May-2008
. It also recognizes the hh:mm:ss
time format. So, for example, if you enter (1/5/2012)
into a definition or table cell, the outer parentheses make this an expression, and it parses the inner expression as two divisions, (1/5)/2012
; however, it parses (1-Jan-2012 14:15:00)
as a date-time value.
When Display dates as numbers in the number format is checked, then the generalized date parsing is not applied to entries, so that a definition 1-5-2012
would be interpreted as two consecutive subtractions. The canonical format, e.g., 1-May-2008
, continues to be recognized.
Regional and language settings: The language for day and month names and the formats used for Short and Long dates depend on the regional settings for Windows. In the U.S., you might see a short date as 9/12/2008
, but in Denmark you might see 12.9.2008
. You can review and change these settings in Regional and Language options available from the Windows Control Panel. These apply to Analytica and all standard Windows applications. To modify settings, click the Customize button and select either the Date tab or Languages tab. For example, if you set the language to Spanish (Argentina), a variable with the Long date setting, the date displays as:
StartDate → Sábado, 04 de Febrero de 2012
where
Variable StartDate := MakeDate(2012, 2, 4)
Date numbers and the date origin: Analytica represents a date or date-time as a date number, that is, the number of days since the date origin. By default, the date origin is Jan 1, 1904, as used by most Macintosh applications, including Excel on Macintosh, and all releases of Analytica on Macintosh and Windows up to Analytica 3.1. If you check Use Excel date origin in the Preferences dialog, the date origin is Jan 1, 1900, as used by default in Excel on Windows and most other Windows software.
With Use Excel date origin checked, the numeric value of dates are the same in Analytica and Excel for Windows for dates falling on or after 1 Mar 1900. Because of a bug in Excel, in which Excel incorrectly treats Feb 29, 1900 as a valid day (1900 was not really a leap year), dates falling before that date do not have the same numeric index in Analytica as they do in Excel.
If you want to paste or link values from Excel or other Windows software to or from Analytica, you should check this option.
Display dates as numbers: Check this box to display the date-time value as a simple number -- the number of days since the date origin. This setting also suppresses the more liberal interpretation of expressions as dates or times during parsing.
Display numbers as dates: Check this box to display a number in date or time format, interpreting it as the number of days since the date origin.
Range of dates: Analytica can handle dates from 1 CE to well beyond 9999 CE (CE means Common Era or Christian Era, and is the same as AD). Dates earlier than the date origin are represented as negative integers. Dates use the Gregorian calendar, so years divisible by 4 are leap years and those divisible by 100 are not leap years, except those divisible by 400 which are leap years.
- Date arithmetic and functions:
- You can simply add an integer n to a date to get the date n days ahead. Numerous functions exist for working with dates and times, including the MakeDate(), MakeTime(), DatePart(), DateAdd(), Today(), ParseDate(), Sequence(), NumberToText(),
YearFrac(), Floor(), Ceil() and Round() functions.
See Also
Enable comment auto-refresher