Oh cool - I missed that. I was testing on 1.13. A reason to upgrade this service. :)
On Monday, December 12, 2022 at 12:40:42 PM UTC Andrey Yugai wrote: > I think larger units were added since 1.14, but if you cannot upgrade for > some reason, Timex has a nice API: `Timex.shift(dt, months: 1, days: 4.5, > minutes: -30, seconds: 50)` > > > > > > > Sent from Proton Mail mobile > > > > > -------- Original Message -------- > On 12 Dec 2022, 20:21, Daniel Kukuła < danie...@gmail.com> wrote: > > > Hi - this bothers me because every time when I wan't to add longer period > of time I need to manually calculate the number instead of use something > built in or use erlang. > > `DateTime.add(DateTime.utc_now(), :timer.hours(-30 * 24), :millisecond)` . > > Erlang has up to 1hour shortcut functions - but 1day still is 24h and > everytime let's say we wan't to expire some old data from database then > DateTime.add(-30, :days) is still plenty good for most of the cases. > In python timedelta you can specify also weeks: > ``` > from datetime import timedelta delta = timedelta( days=50, seconds=27, > microseconds=10, milliseconds=29000, minutes=5, hours=8, weeks=2 ) > ``` > > -- > 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 elixir-lang-co...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/b3abc7f0-7989-42f5-a087-3443155f69d6n%40googlegroups.com > > <https://groups.google.com/d/msgid/elixir-lang-core/b3abc7f0-7989-42f5-a087-3443155f69d6n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > -- 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 elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/5ba4afd9-f6fb-44ab-a6fe-35e44748eb99n%40googlegroups.com.