简体   繁体   中英

Timex - Getting the timezone information from DateTime

I am looking for a way to get the timezone information back from a date time.

iex(13)> t = Timex.now("America/Los_Angeles")
#<DateTime(2016-10-23T12:45:34.697369-07:00 America/Los_Angeles)>
iex(14)> Timex.<given_t_return_timezone>??

Given t , I want back "America/Los_Angeles" again.

I knew it had to be easy. Rather than looking at Timex for this, we can simply do:

t.time_zone

This is part of Elixir itself since t is a DateTime .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM