Date and Time Values


Release:

 • 4.6 •  5.0 •  5.1 •  5.2 •  5.3 •  5.4 •  6.0 •  6.1 •  6.2 •  6.3 •  6.4 •  6.5 •   •  6.6 •  7.0 •  7.1 •  7.2


Dates and times are treated as numeric quantities, denoting the number of days elapsed since the date origin (usually 1-Jan-1904, or 1-Jan-1900 if the Use Excel date origin preference is checked). Dates can be entered directly into an expression, at any point in an expression and regardless of the number format setting, using the syntax d-MMM-yyyy, such as 27-Jan-2010, using a 3-letter English-language month abbreviation. Times can be entered in the format hh:mm:ss [tt], such as 10:27:00pm or 22:27:00, which becomes a fractional value between 0 and 1. A combined date-time can be entered as, e.g., 27-Jan-2010 10:27:00pm. In the general case, you cannot enter other date formats within an expression. For example, 1/27/2010 would be interpreted as two divide operators, (1/27)/2010, and regional (non-English) month names, e.g., 27-Ene-2010, are not recognized.

You can enter dates and times in more general formats, and in region/culture-specific styles, when the number format is set to Date and the date, time or date-time is the only element appearing in the expression. In this case, Analytica recognizes almost all commonly used formats, such as 27-January-2010, 1/27/2010, 1-27-2010, or Jan 27, 2010. When you enter a date in a format such as 1/2/2010 or 1-2-2010, the date is interpreted based on your regional setting. For example, in the US, these would parse to 2-Jan-2010, while in Europe they would generally parse as 1-Feb-2010. Non-English month names are also recognized in languages that use characters only from the standard Analytica character page (which includes most western European languages). For example, 27-Enero-2010 is recognized if you are in Spain.

ISO 8601 date-times and time zones (new to Analytica 7.2): You can also enter a date or date-time in the ISO 8601 form yyyy-MM-dd or yyyy-MM-ddTHH:mm:ss (with optional fractional seconds) anywhere in an expression, e.g., Sequence(2025-08-25T00:00:00, 2025-08-27T00:00:00, dateUnit: 'D'). The month and day must each be two digits, so 2025-8-25 inside an expression is still two subtractions. A UTC offset written directly after the time, Z, +HH:MM, +HHMM or +HH (with either sign), is part of the literal, e.g., 2025-08-25T00:07:05.000+0000; a space before the sign makes it ordinary arithmetic, as in 2025-08-25T00:07:05 + 01:30.

A date-time value itself has no time zone. The model's Sys_TimeZone system variable (default 'Local', this computer's zone; also on the Preferences dialog) says which zone the model's date-times are in. A literal or parsed text that carries an offset is converted into that zone, so 2025-08-25T00:07:05Z is 24-Aug-2025 17:07:05 in a model whose zone is US Pacific. Values without an offset are taken as already being in the model's zone and are never converted. See Date Functions, ParseDate and NumberToText (the ISO8601 output format).

See Also


Comments
Loading comments...