DateTime

Overview

This library supports serializing and deserializing DateTime value fields.

Serialization

DateTime values are serialized as a TOML date-time.

They are serialized in ISO 8601 format, with the following format: yyyy-MM-dd HH:mm:ss.FFFZ by default.

The Z at the end indicates that the time is in UTC, and the T separator is omitted for clarity.

The format can be changed by specifying the TomlDateTimeFormatAttribute.

Deserialization

DateTime values are deserialized from TOML as a TOML date-time.

Any format that is supported by the DateTime.Parse method will be deserialized.

Example

[Serializable]
public class PlayerAccount
{
    private DateTime _createdDate;
    private DateTime _lastLoginDate;
}

Can be serialized and deserialized as the following TOML document:

createdDate = 2021-01-01 00:00:00Z
lastLoginDate = 2022-08-04 00:00:00Z