The time zone concept supports multi-entity installations whenever various users operate in various time zones. In the standard implementation, the time zone is kept the same for all users in a particular entity. (In the project overlay, the granularity can be increased enabling various users to be allocated to various time zones in the same entity.)
The concept covers the following specifications:
The times of specific incidents (login time, event time, SLA target time, login entries, etc.) are displayed in the local time for each user. At the same time, these times are stored and administered in the whole system for comparative purposes. This means that an administrator, for example, can identify the real time of an event. Although users in various time zones may be working on the same object (e.g. capturing a transaction in the US, releasing it in China), the depiction of the chronological sequence of events remains consistent and transparent for users across all time zones.
Banking entries (due dates, last date of shipment, value dates) are not affected by the concept.
Logically, the 'datetime' data type consists of a date and a time. Before the data type 'datetime' was introduced, such items were represented by two data fields (a date and a time, e.g. EVT/DAT and EVT/TIM). Saving the date in two fields like this makes it difficult to convert the information automatically (from time saved to time displayed) for different time zones.
The 'datetime' data type is only applied to datafields that describe points of time in real time. These include:
For a full list, see all the 'datetime' fields in the list of fields for each table.
The 'datetype' data type is used for datafields that indicate a general date (usually relevant to a specific location) and not a specific point in time defined down to the second. Such 'datetype' fields are not subject to change and will continue to be used as has been the case in the past for details of business dates (opening date, value date, due date, last date of shipment) as issued in SWIFT messages. For these dates, a geographical location is either legally implicit or explicit and the dates never change regardless of where in the world this information is displayed.
'datetype' will continue to be used in CBS/RNGMOD dates.
The following concepts are relevant for installations using time zones:
All values are stored in the TZSystem's time zone. However, they are converted to and displayed in the TZUser's time zone. The technical conversion from a value stored internally in TZSystem is carried out via the display controls, or TDBasic functions, that convert or transfer the contents of a 'datetime' field into another format.
'today' and 'time' functions always deliver the date and time of the relevant process for the respective time zone. Thus, an American user will be able to see that a transaction was carried out at 11.00 a.m. on a given date, even though the system may well be running in China, and the event was carried out after midnight there on the following day.
For the 'datetime' data type, there is just one 'datetime' view type that is largely applied in 'read only' mode. These fields are stored as timestamps in the datebase (as is the already the case with 'datetype' data). All values are stored in the TZSystem's time zone. However, they are converted to the TZUser's time zone.
The DATTIMM module is used to edit 'datetime' data. This prepares the date and time taken from the field separately. The module is applied in info transactions (INFSMH, INFTRN) for example.
'datetype' and 'datetime' are NOT compatible in assignments (only DBSQLDate and FmtDate allow both types to be used as arguments). Appropriate TDBasic functions are available for the conversion.
[System]
TZSystem=<Name of system time zone>
TZUser=<Name of user time zone>
TZUser is defaulted from TZSystem. There is no default for TZSystem. If the entry has not been set, time zone conversion is deactivated.
[<UIL>-Longset]
DateTimeShort=<Short format for DateTime>
DateTimeLong=<Long format for DateTime>
DateTimeShort and DateTimeLong define output frames, according to DateShort and DateLong, with an expanded frame (see FmtDate).
The list of time zones is stored in a separate INI file 'ini/TZ.ini' (the format is similar to the Unix environment variable time zones, but with the difference that the time zone is left of the equals sign and that for the start and end of summer time, the two variations are not supported in the Julian calendar).
[Timezones]
tzname=offset[dstname[offset][,start[/time],end[/time]]]
tzname=Name of time zone
offset=[+ or -]hh[:mm[:ss]]
dstname=Alternative name for summer time
start=Mm.n.d with 1 ≤ m ≤ 12 (month), 1 ≤ n ≤ 5 (week in the month, 5 refers to the last week in the month), 0 ≤ d ≤ 6 (day of the week, 0 = Sunday)
time=hh[:mm[:ss]] (if not otherwise indicated, the default is 02:00:00)
Example:
[Timezones]
CET=+01:00CEST+02:00,M3.5.0/02:00,M10.5.0/02:00
When saving time in TZSystem, any possible shifts in summer time are ignored to avoid any ambiguous indications of time when converting to winter time.
The following functions also permit 'datetime' arguments in addition to 'datetype' arguments.
FmtDate, FmtDateShort and FmtDateLong, whereby FmtDate contains an additional format letter for time:
DBSqlDate accepts 'datetype' or 'datetime' as an argument; the nature of their processing depends on the data type.
tdconst.ini contains the two symbolic constants 'tdContextTZuser' and 'tdContextTZSystem'.
For all functions with an optional 'time zone' argument the following applies:
Instead of the string that comprises the name of the system time zone, (the result of GetContext(tdContextTZSystem), 'tdContextTZSystem' can be used directly as an argument. Unless otherwise indicated, the 'TZUser' is used.
In most situations, therefore, developers do not have to worry about time zones.
The time part of 'datetime' (for DateTimeGetTime, DateTimeSetTime, DateTimeMake functions) is displayed as (hh+mm/100+ss/10000) in line with the established format for time. The most precise definition of time is 1/1000 sec (1 millisecond).
Time indications using 'decimals' in data fields refer to the precision of time in the datafield (0 = seconds, 3 = milliseconds = maximum precision). The default for decimal places is '0'.
In SYSMOD there are two global functions defined that can be used to convert string to TradeDesign timestamps.
Returns TradeDesign date from string ArgDateTxt given in any format
Errorcodes:
Code | Description |
---|---|
-110 | date has missing data (month or day or year) which is defaulted to 01 January Year(Today) |
110 | date parse failed |
114 | date does not fit the given format |
115 | date can't be unambiguously resolved |
For datetime conversion use correspondent function: DateTimeMakeFromString
Available separators are: “/”, “-”, “.”, “ ”, no separator
The date string might contain weekday (e.g. Sun, Sunday etc) which is ignored
The day might contain English suffix (i.e. 1st, 2nd, 3rd, 4th, etc) which is ignored
If date does not contain Year (e.g. 01/01 or January 1st) - the year is defaulted with today's year
If year is not complete (e.g. 31/12/20) the year will be complemented according to Swift rule:
Source Year | Target Year |
---|---|
> 79 | 19xx |
⇐ 79 | 20xx |
The input string can be in any of the following formats (but not limited to them if respective ArgFmt provided):
Extracts TradeDesign datetime format from timestamp text ArgDateTxt
Datetime returned is in the current timezone of the system
Timestamp can be in any format
If datetime cannot be retrieved - errorcode 110 will be raised and NULLDATETIME returned
If timestamp does not contain some data, the missing data will be defaulted to epoch start timestamp
1970-01-01T00:00:00Z
In the current system timezone tdContextTZSYSTEM
Correspondent function to get Date only: DateFromString