datetime – cavaliba.com
Description: FieldType DateTime

`CTRL K`

Documentation
Data Field Reference
datetime

# datetime

Represents a date and time value with timestamp precision.

## dataformat: datetime

      MYFIELD:
          dataformat: datetime
          default_value: "2025-01-01 00:00:00"

## dataformat_ext

Not used - DateTime fields have no extended options.

## Format

DateTime values are stored and displayed as: YYYY-MM-DD HH:MM:SS

Examples:

- 2025-01-15 14:30:00
- 2024-12-31 23:59:59
- 2025-06-20 09:15:30

### Accepted input formats

On input (form field, import, API), ISO 8601 is also accepted and is normalized to the canonical format above when the value is saved:

- `T` separator instead of a space: `2025-01-15T14:30:00`
- a trailing `Z` or a `+HH:MM`/`-HH:MM` offset, converted to UTC on save: `2025-01-15T14:30:00Z`, `2025-01-15T12:30:00+02:00`
- fractional seconds, truncated (not rounded) on save: `2025-01-15T14:30:00.123Z`

A value with no time component (date only) is not a valid `datetime` value.

## Timezone

Naive input (no `Z`/offset) is stored unchanged. Input carrying a `Z` or an explicit offset is converted to UTC before storage. Once stored, the field itself carries no timezone information.

## Multivalue

Multi-value is supported for storing multiple timestamps.

    ## SCHEMA
    MYEVENTS:
          dataformat: datetime
          cardinal_max: 0

    ## INSTANCE multi-valued
      MYEVENTS: ["2025-01-15 14:00:00", "2025-01-16 10:30:00"]

## Examples

### Schema Definition

    - classname: _schema
      keyname: document
      created_at:
        dataformat: datetime
        displayname: Created At
        description: Document creation timestamp

### Instance Example

    - classname: document
      keyname: doc1
      created_at: "2025-01-10T09:00:00Z"

`created_at` above is written in ISO 8601 with a `Z` suffix to illustrate accepted input; it is stored as `2025-01-10 09:00:00`.

## Notes

- Edit form uses a plain text input; there is no datetime picker widget.
- Suitable for audit trails, event logs, and scheduling
- Use `date` field type if time component is not needed
- Use `time` field type if date component is not needed

date time