DateTime
A UTC instant represented as Unix seconds + nanoseconds.
Type Methods
now()
Returns the current UTC time.
from_unix seconds :nanoseconds?
Creates a DateTime from Unix epoch components.
Parameters:
| Name | Type | Description |
|---|---|---|
seconds |
int |
Whole seconds since Unix epoch |
nanoseconds |
int |
Optional fractional nanoseconds component |
parse_rfc3339 text
Parses an RFC3339 timestamp.
Parameters:
| Name | Type | Description |
|---|---|---|
text |
str |
RFC3339 input text |
Returns: DateTime
Errors:
- The input is not a valid RFC3339 timestamp.
Fields
| Field | Type | Description |
|---|---|---|
seconds |
int |
Whole Unix seconds |
nanoseconds |
int |
Nanoseconds in range [0, 1_000_000_000) |
Operators
DateTime - DateTime -> Duration
Methods
rfc3339()
Returns the RFC3339 representation.
Returns: str
String Form
str(datetime) renders the same UTC RFC3339 timestamp as datetime.rfc3339().