A fork of erlang_localtime specifically reworked to be compatible with qdate
APACHE-2.0 License
This is a fork of the excellent library,
erlang_localtime. The purpose
of this fork is specifically for compatibility with
qdate. The two are mostly compatible,
but have diverged slightly over the years. The qdate tests will not pass if the
original erlang_localtime dependency
is used due to some subtle differences
to attempt to make qdate a little bit smarter.
utc_to_local(DateTime, Timezone)
- converts UTC time to local according to specified Timezonelocal_to_utc(DateTime, Timezone)
- converts local time to UTClocal_to_local(DateTime, TimezoneFrom, TimezoneTo)
- converts local time to localtz_name(DateTime, Timezone)
- returns a timezone name (E.g. MSK, MSD, etc)tz_shift(DateTime, Timezone)
- returns time difference between local datetime and GMTtz_shift(DateTime, TimezoneFrom, TimezoneTo)
- returns time difference between local datetime and required timezoneConverts UTC time to local one
localtime:utc_to_local({{2010, 7, 22}, {17, 56, 23}, "Europe/Moscow").
{{2010,10,10},{21,56,23}}
Converts local time to UTC one
localtime:local_to_utc({{2010, 10, 10}, {21, 56, 23}}, "Europe/Moscow").
{{2010,10,10},{17,56,23}}
Converts time from one local timezone to another local one
localtime:local_to_local({{2010, 10, 10}, {21, 56, 23}}, "Europe/Moscow", "Australia/Sydney").
{{2010,10,11},{3,56,23}}
Returns timezone name
localtime:tz_name({{2010, 10, 10}, {21, 56, 23}}, "Europe/Moscow").
{"MSK","MSK"}
localtime:tz_name({{2010,10,11},{3,56,23}}, "Australia/Sydney").
{"EST","EST"}
Calculates time difference between UTC and local one
localtime:tz_shift({{2013, 01, 22}, {18, 17, 00}}, "Europe/Moscow").
{'+',4,0}
localtime:tz_shift({{2013, 01, 22}, {18, 17, 00}}, "America/New York").
{'-',5,0}
Calculates time difference between two local timezones
localtime:tz_shift({{2013, 01, 22}, {18, 17, 00}}, "America/New York", "Europe/Moscow").
{'+',9,0}