# How to add 1 day to a Posix in 0.19

**URL:** <https://discourse.elm-lang.org/t/how-to-add-1-day-to-a-posix-in-0-19/2167>\
**Category:** Learn\
**Created:** [October 8, 2018, 11:17pm UTC](https://discourse.elm-lang.org/t/how-to-add-1-day-to-a-posix-in-0-19/2167 "2018-10-08T23:17:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![brendangibsondrip](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@brendangibsondrip](https://discourse.elm-lang.org/u/brendangibsondrip)\
**Post date:** [October 8, 2018, 11:17pm UTC](https://discourse.elm-lang.org/t/how-to-add-1-day-to-a-posix-in-0-19/2167/1 "2018-10-08T23:17:44Z")

</div>

I am upgrading from 0.18 to 0.19.

I previously had code like  
**add Day -1 from**

now that **from** is a **Posix** , how do I replicate that functionality?

---

<div class="post-metadata">

**Author:** ![Sebastian](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/sebastian/32/98_2.png) [@Sebastian](https://discourse.elm-lang.org/u/Sebastian)\
**Post date:** [October 8, 2018, 11:33pm UTC](https://discourse.elm-lang.org/t/how-to-add-1-day-to-a-posix-in-0-19/2167/2 "2018-10-08T23:33:16Z")

</div>

Something like this will add 24 hours

```
posix
    |> Time.posixToMillis
    |> (+) (24 * hour)
    |> Time.millisToPosix

```

hour =  
1000 \* 60 \* 60

But this doesn’t account for any daylight savings time changes, which might not be what you want.

---

<div class="post-metadata">

**Author:** ![Nathan\_Schultz](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/nathan_schultz/32/1382_2.png) [@Nathan\_Schultz](https://discourse.elm-lang.org/u/Nathan_Schultz)\
**Post date:** [October 9, 2018, 12:56am UTC](https://discourse.elm-lang.org/t/how-to-add-1-day-to-a-posix-in-0-19/2167/3 "2018-10-09T00:56:06Z")

</div>

I’ve been using the Time.Extra package by Justin Mimbs which works with Posix in 0.19:

[https://package.elm-lang.org/packages/justinmimbs/time-extra/1.0.1/Time-Extra](https://package.elm-lang.org/packages/justinmimbs/time-extra/1.0.1/Time-Extra)

e.g:

```
posix |> add Day -1 Time.utc
```

---

<div class="post-metadata">

**Author:** ![brendangibsondrip](https://avatars.discourse-cdn.com/v4/letter/b/53a042/32.png) [@brendangibsondrip](https://discourse.elm-lang.org/u/brendangibsondrip)\
**Post date:** [October 9, 2018, 2:34pm UTC](https://discourse.elm-lang.org/t/how-to-add-1-day-to-a-posix-in-0-19/2167/4 "2018-10-09T14:34:05Z")

</div>

Thanks - are you happy with that package?

---

<div class="post-metadata">

**Author:** ![Nathan\_Schultz](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/nathan_schultz/32/1382_2.png) [@Nathan\_Schultz](https://discourse.elm-lang.org/u/Nathan_Schultz)\
**Post date:** [October 10, 2018, 1:09am UTC](https://discourse.elm-lang.org/t/how-to-add-1-day-to-a-posix-in-0-19/2167/5 "2018-10-10T01:09:16Z")

</div>

Yes, I’m happy with it; I haven’t come across any issues thus far - but I’m not doing anything particularly strenuous either (I’m not dealing with multiple time-zones).

The author is active and also has a package for time-zones (justinmimbs/timezone-data) with the in-built IANA time-zone database. He also has a date-extra package for 0.18.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [October 20, 2018, 1:09am UTC](https://discourse.elm-lang.org/t/how-to-add-1-day-to-a-posix-in-0-19/2167/6 "2018-10-20T01:09:17Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
