We already have `DateTime.utc_now()` as a shortcut for
`DateTime.now("Etc/UTC")`. So it would make sense to add `to_utc/1` as a
convenience function as well here.
On Thursday, January 14, 2021 at 8:03:13 PM UTC+1 Zubair wrote:
> If the same thing is achievable which is a single line of code, I don't
> think it would be appropriate. It can be easily achieved by
> `DateTime.shift_zone!(dt, "Etc/UTC")`
>
>
> On Thursday, 14 January 2021 19:07:30 UTC+5:30, [email protected] wrote:
>>
>> What do you think of adding a convenience function:
>> `DateTime.to_utc(dt)`
>>
>> Which would be a shortcut for:
>> `DateTime.shift_zone!(dt, "Etc/UTC")`
>>
>> As converting back to UTC might be a common need for some applications,
>> and writing systematically "Etc/UTC" is a bit ugly.
>>
>>
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/4ad2482b-881e-4b60-b546-08fbb0ddf7cfn%40googlegroups.com.