The eXtremeDB
datetime
type is a 64-bit integer value used to store the date and time in databases. The precision ofdatetime
values is determined by the runtime parameterDATETIME_PRECISION
. Numerically, the precision represents the number of ticks per second. The default value forDATETIME_PRECISION
is 1, which means that the database stores adatetime
value as the number of seconds since the EPOCH (i.e. 00:00:00 UTC 1 January 1970). The resolution ofdatetime
fields can be changed by an application at runtime to a resolution ranging from 1 (to store the number of seconds) to 1000000000 (for the number of nanoseconds). (However, note that the Java Date type uses millisecond resolution and the C# Datetime uses 100-nanosecond resolution. So these limitations apply to the database values possible with these native language APIs.)
It is important to note that the value of
DATETIME_PRECISION
is a per-process parameter; all processes working with the same database must set the same value forDATETIME_PRECISION
. Respectively, all databases accessed from a given process will have the same precision.Arithmetic on Date, Time and Datetime Fields
When using
date
,time
ordatetime
fields in SQL, if any operand of the arithmetic expression is of typedate
,time
ordatetime
, then the other operand is converted todatetime
and the result of expression is of typedatetime
. The result will be formatted for output depending on the original type. So, for example adate
fieldday
could be incrementedday+5
and the result will be of typedate
.However, note that outside SQL,
date
andtime
fields areuint4
values, whiledatetime
fields areuint8
. There are no special "operations" defined for these fields. The above rule is applicable to SQL only.
Native Language APIs
The APIs for managing date, time and datetime fields are specific to the programming language used. Please use the links below to view detailed explanations and examples for your development environment:
SQL Managing date, time
anddatetime
fields in SQLC Managing date, time
anddatetime
fields in CC++ Managing date, time
anddatetime
fields in C++Java Managing D ate
fields in JavaPython Managing fields in Python
datetime
C# Managing Datetime
fields in C#