View Source LocalTime (local_time v0.1.1)

Documentation for LocalTime.

Summary

Functions

Converts anything to local DateTime.

Converts anything to local DateTime or raises.

Converts a Local NaiveDateTime to a DateTime in the local time zone.

Converts a UTC NaiveDateTime to a DateTime in the local time zone.

Converts a unix timestamp to a DateTime in the local time zone.

Converts a Date and Time to a DateTime in the local time zone.

Returns the current time in the local time zone.

Gets the configured timezone.

Returns the number of seconds since 1970. Note that a UNIX time is always UTC, so this doesn't change that.

Functions

from(ndt)

Converts anything to local DateTime.

from!(thing)

Converts anything to local DateTime or raises.

from_naive(ndt)

Converts a Local NaiveDateTime to a DateTime in the local time zone.

from_naive_utc(ndt)

Converts a UTC NaiveDateTime to a DateTime in the local time zone.

from_unix(time)

Converts a unix timestamp to a DateTime in the local time zone.

new(date, time)

Converts a Date and Time to a DateTime in the local time zone.

now()

Returns the current time in the local time zone.

time_zone()

Gets the configured timezone.

Examples

iex> LocalTime.time_zone()
"America/New_York"

unix_now()

Returns the number of seconds since 1970. Note that a UNIX time is always UTC, so this doesn't change that.