Surgex.DateTime (Surgex v4.8.0-git-fbda) View Source

Utilities for creating date times.

Link to this section Summary

Functions

Create UTC or time-zone date time given a date and seconds (from midnight) offset.

Link to this section Functions

Link to this function

date_and_offset_to_datetime(date, seconds_since_midnight, timezone \\ "Etc/UTC")

View Source

Specs

date_and_offset_to_datetime(Date.t(), integer(), String.t()) :: DateTime.t()

Create UTC or time-zone date time given a date and seconds (from midnight) offset.

Examples

iex> Surgex.DateTime.date_and_offset_to_datetime(~D{2021-10-07}, 5400) ~U[2021-10-07 01:30:00Z]

iex> Surgex.DateTime.date_and_offset_to_datetime(~D{2021-10-07}, 3600, "Europe/Warsaw") #DateTime<2021-10-07 01:00:00+02:00 CEST Europe/Warsaw>