Skip to content

Add support for java.time.Instant #278

Open
@zdanek

Description

@zdanek

Hi.
I run into this problem in my project. I can support you with relevant info and code, to get this done.
We need this codec as java.time.Instant is modern type for storing datetime when using machine-to-machine communication.

The problem is to choose which store type to use.
Use datetimeoffset in this case is tempting but I'd not use it. The reason is that we're aiming to store Instant as date time in UTC timezone only. So we have fixed TZ. Using datetimeoffset allows to define or put data in different timezone than UTC.

Using datetime2 is the best approach. It does not declare TZ explicitly but here we have only one possible TZ and it's UTC.
The way datetime2 works is taking datetime as it is, with trimming Z that denotes TZ. It's simply omitted. And this is what we need taking java.time.Instant as an input.

@mp911de
I can provide working Codec for this but I need your approval and agreement on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions