[TOC] [Prev] [Next] [Bottom]



<@ISDATE>, <@ISTIME>, <@ISTIMESTAMP>

Syntax

<@ISDATE VALUE=date>

<@ISTIME VALUE=time>

<@ISTIMESTAMP VALUE=timestamp>

Description

These tags attempt to parse the input value and see if it is a valid date, time, or timestamp, respectively. The intent of the tags is to detect as wide a variety of formats as possible, thus allowing users greater choice in inputting values. The tags evaluate to the value "1" or "0".

If the value contains spaces, it must be quoted (single or double, as appropriate).

The tags currently support the following date/time/timestamp formats:

  • configuration variable defaults
  • ISO 8601 formats (complete representations only)
  • ODBC formats
  • numeric formats
  • textual formats.

All formats assume the Gregorian calendar; that is, they use Gregorian rules for all time periods as opposed to switching back to the Julian calendar for years before the adoption of the Gregorian calendar, which may vary depending on the country. All years must be greater than zero.

A date unacceptable in one format may be acceptable in another. For example, 98-02-12 is not a valid ODBC nor ISO date, but is detected as a general numeric date because it is sufficiently unambiguous.

ISO Date Format

There are three ways to specify a date in ISO format:

  • Calendar Date Format: yyyy-mm-dd. An ISO Calendar Date format gives years, months, and dates in numeric values. All digit places of each field must be filled. Use leading zeroes to pad fields to full width. Hyphens are optional, but if present, all must be present; they are all-or-none optional, for example, "1998-05-01" or "19980501".
  • Week/Day Format: yyyy-Www-d. An ISO Week/Day format specifies a date with its week number in the given year, plus its day in the week. The capital W is required, the hyphens are all-or-none optional, and numbers must be full-width. Weeks range from W01 to W53, and days in each week are numbered one (Monday) to seven (Sunday).

Week W01 of any year is defined as the first week with the majority of the days of that week in that year; for example, it is the week that January first is in if January first falls on a Monday to a Thursday, or else it is the next week. Alternately, the week containing January 04 is W01. Remember that ISO defines a week as Monday to Sunday.


!Note: Note that the calendar year may be different from the week year. For example, 1998-W01-2=1997-12-31, is December 31, 1997.


  • Ordinal Date Format: yyyy-ddd. An ISO Ordinal Date format specifies a year and the day in that year numbered from January first as 001. The day number ranges from 001 to 365 (366 in leap years). The hyphen is optional. The full width of the digit fields must be provided; use leading zeroes to pad fields.
ISO Time Format

An ISO time is specified in a 24-hour clock format: hh:mm:ss

The string may be preceded by a capital T, and may have a decimal fraction portion consisting of a comma or period followed by one to nine digits. Colons are all-or-none optional.


!Note: ISO allows 24:00 to indicate 00:00:00 on the next day, but Tango does not allow this.


ISO Timestamp Format

An ISO timestamp format is simply the concatenation of a date and a time in that order, with the capital T before the time mandatory. Again, no spaces ever appear in an ISO format, for example,
"1998-05-01T12:00:00".

ODBC Formats

ODBC date/time string formats are very strict. No special interpretation is required.

ODBC Date Format

Dates are specified yyyy-mm-dd using calendar dates. The full width of each field must be provided. Use leading zeroes to pad fields to full width. Hyphens are required.

ODBC Time Format

The time format hh:mm:ss.fffffffff is a triple of two-digit numbers representing a 24-hour time, with colons required, followed by an optional fraction portion consisting of a period with one to nine decimal digits afterwards. Use leading zeroes to pad fields to full width.

ODBC Timestamp Format

Timestamps are made by specifying a date, followed by a single space, followed by the time.

Numeric Formats

A numeric format is defined to be a date or time specified fully by using numbers, separating punctuation, and possibly an "AM" or "pm" marker. Any strings with words inside fall into the Textual category.

These tags do not attempt to resolve ambiguities according to the current locale or Tango Server settings. Ambiguous values are not accepted.

Dates are composed of three numbers separated by identical punctuation character sequences: "/", "//", ".", or "-". Times are specified by three numbers separated by identical punctuation characters: ":" or ".", with an optional am/pm (case insensitive) marker afterwards. If an am/pm marker is present, then a single space may separate it and the time numbers. Timestamps are created by writing a date, followed by white space, followed by a time. A time may never be specified first.

Textual Formats

A textual format is any date/time string that includes alphabetic characters. These words are assumed to be weekday and month names in a variety of different languages. Input text must use high-ASCII characters instead of HTML &#xxx; escapes to represent accented characters. The following languages that use the ISO-Latin-1 character coding set are supported:

  • C/POSIX DEFAULT
  • Danish
  • German
  • English
  • Spanish
  • Finnish
  • French
  • Icelandic
  • Italian
  • Dutch
  • Norwegian
  • Portuguese
  • Swedish.

A date may be written in any of the following formats, with [] indicating optional items.

  • [weekday] month day year
  • [weekday] day month year
  • year month day (hyphen delimiters allowed).

The weekday may only be followed by an optional comma and a space. Other items may use dots, or single dots as well. If a weekday is specified, it must be correct. For example, June 13 1997 was a Friday, and anything else is wrong. No extraneous words should appear in the string, such as the "de" in Spanish "viernes, 20 de junio de 1997". In general, no punctuation is best. (Punctuation is supported to the point of allowing what is commonly in use today.) All word comparisons are case-insensitive.

If a time is given, it must have three numbers, two digits long (1-2 for the hour), separated by "." or ":", and an optional space with an optional am/pm marker used in that native language. No delimiters follow or precede a time otherwise. A time may appear anywhere in the text.


!Note: The current implementation of the IS[DATE/TIME/ TIMESTAMP] tags only works with languages that use the ISO- Latin-1 character set.




[TOC] [Prev] [Next] [Bottom]



docs@pervasive.com

Copyright © 1998, Pervasive Software Inc. All rights reserved.