Allowed Formats of Various Data Types
Various data types have several widely accepted formats. Numbers can be written with or without separating commas, or in standard form. Sums of money are usually expressed as units and hundredths of units. Dates and times have many display options, as listed in the table below. Internally, values of any given data type are manifest in the same form and stored the same way. The Dissemino general policy is to allow data to be entered using any of the accepted formats within forms, but displayed in only one format within pages.
HTML can set the text font, left or right justify text, and place text in bold, italics or neither. What it does not do is determine the display format of values. This must be done elsewhere in the webapp configs, usually in field specifications.
Allowed Formats of Dates
SDATE (short form date) values, manifest within programs as hzSDate instances, are 32-bit unsigned integers representing the number of days since Jan 1, 0000. TIME values, manifest as hzTime, are 32-bit unsigned integers representing the number of seconds past midnight. XDATE (full form date and time) values, manifest as hzXDate, are a pair of 32-bit unsigned integers, respectively representing the number of hours since midnight Jan 1, 0000, and the number of microseconds past the turn of the hour. Note that SDATE, TIME and XDATE do not encode a time zone. Internally, all dates and times use the UTC time zone.
The display formats for date and time values are as listed in the HadronZoo library bitwise enum, hzDateFmt as follows:-
FMT_DT_UNKNOWN | 0x0000 | Invalid or uninitialized format | |
Dates control flags | |||
FMT_DATE_DOW | 0x0001 | Print the dow (this will appear first) | |
FMT_DATE_USA | 0x0002 | Where applicable, put day before month | |
FMT_DATE_ABBR | 0x0004 | Write words (eg dow and monthname) out in short form | |
FMT_DATE_FULL | 0x0008 | Write words (eg dow and monthname) out in full | |
Date only formats | |||
FMT_DATE_DFLT | 0x0010 | Default format YYYYMMDD | |
FMT_DATE_STD | 0x0020 | Standard format YYYY/MM/DD | |
FMT_DATE_NORM | 0x0040 | Normal format DD/MM/YYYY (UK) or MM/DD/YYYY (US) | |
FMT_DATE_FORM | 0x0080 | Day_of_month+monthname+YYYY (UK) or monthname+day_of_month+YYYY (US) | |
Time only formats | |||
FMT_TIME_DFLT | 0x0100 | Time HHMMSS | |
FMT_TIME_STD | 0x0200 | Time HH:MM:SS | |
FMT_TIME_USEC | 0x0400 | Time HH:MM:SS.uSec | |
Timezones (always last) | |||
FMT_TZ_CODE | 0x1000 | Timezone as code | |
FMT_TZ_NUM | 0x2000 | Timezone as number of hours +/- GMT | |
FMT_TZ_BOTH | 0x3000 | Timezone as digits plus (code in braces) | |
Combined Date and Time formats | |||
FMT_DT_DFLT | FMT_DATE_DFLT + FMT_TIME_DFLT | YYYYMMDD HHMMSS | |
FMT_DT_STD | FMT_DATE_STD + FMT_TIME_STD | YYYY/MM/DD HH:MM:SS | |
FMT_DT_NORM | FMT_DATE_NORM + FMT_TIME_STD | DD/MM/YYYY (UK) or MM/DD/YYYY (US) followed by HH:MM:SS | |
FMT_DT_USEC | FMT_DATE_STD + FMT_TIME_USEC | YYYYMMDD HH:MM:SS.uSec | |
FMT_DT_INET | FMT_DATE_DOW + FMT_DATE_FULL + FMT_TIME_STD + FMT_TZ_NUM | Day of Week + Day_of_month+monthname+YYYY or monthname+day_of_month+YYYY + HH:MM:SS + timezone |
In the configs, the required display format of dates can be set by applying the hzDateFmt value to the applicable field specification or percent entity... In the general case, where a different time zone applies, this would be on a visitor spec ...