Developer / Reference / Data model

Date & Time

Last updated on 02-Oct-2020 by Jakob Jakobsen Boysen
Jakob Jakobsen Boysen

Platform Lead
boysen@scifeon.com

Audited entities (PrimaryEntity, ResultEntity and AssociatedRecord) includes CreatedUtc and ModifiedUtc, which cannot be changed by the user.

We ignore leap seconds and use the Gregorian calendar.

Columns

The following rules must be followed when creating columns for storing date and time:

Prefix

Data type

Description

API format

date*

DATE

Local date, i.e. extracted from the client browser.

YYYY-MM-DD

(no conversion done on backend)

dti*

DATETIMEOFFSET

Local date and time with offset.

YYYY-MM-DDTHH:mm+HH:mm

(no conversion done on the backend)

utc*

DATETIME

UTC date and time, typically machine generate, i.e. not from user input.

YYYY-MM-DDTHH:mm+HH:mm

(shifted to UTC, i.e. removing the offset)

or:

YYYY-MM-DDTHH:mm

(assume already converted)

The data type can be left out, and the data type are automatically set based on the rules above. If a column is prefixed with the above, an error is thrown if the Data type is not set correctly.

Special column: date

If you add a column dateCreated, this will be set automatically when saving using the Scifeon client in the browser, unless you as a developer explicitly set it.

Recommendations

Use CreatedUtc or ModifiedUtc when showing times of related entities (e.g. for messaging).

Calculate differences between comparable columns, e.g. date* and utc* have different formats, and no guarantees on being saved with the same offset.

Consider whether you need a date(time) column for an entity, or if you can use the Event-entity instead.