How to get current utc time in elixir

I want current utc time. But now, If i change the system date and time utc also changes… I want exact global utc time without getting effected by the change in the system date… Is there any way??
I tried using Timex.now and DateTime.utc_now() but both gives current system time in utc.

So, why do you change global time?

Maybe, you don’t need utc time and System.monotonic_time() fits better here?

Thank you for your reply…
But System.monotonic_time() give output like this------>

iex(26)> System.monotonic_time()
-576456591126657905

I want in date time format??

Not global time…System time…When I change the system time Timex.now gives utc of current system time…

And again, why do you change system time? Just setup ntp client and use DateTime.utc_now()/NaiveDateTime.utc_now()/Timex.now().

3 Likes

Could you give an example of the output you get and the output you want?

I used sntp client… And it solved my issue… Thank you…

I want output to look something like this
#DateTime<2019-05-10 06:25:08.366Z>