# Use of timeZone in Instant.periodUntil

**URL:** <https://discuss.kotlinlang.org/t/use-of-timezone-in-instant-perioduntil/26779>\
**Category:** Support\
**Created:** [May 5, 2023, 9:53pm UTC](https://discuss.kotlinlang.org/t/use-of-timezone-in-instant-perioduntil/26779 "2023-05-05T21:53:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronron1024](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@Ronron1024](https://discuss.kotlinlang.org/u/Ronron1024)\
**Post date:** [May 5, 2023, 9:53pm UTC](https://discuss.kotlinlang.org/t/use-of-timezone-in-instant-perioduntil/26779/1 "2023-05-05T21:53:04Z")

</div>

Hi,

In the library **kotlinx.datetime** , what is the point to specify a _timeZone_ with the function **Instant.periodUntil**?

I mean, a period between two instants is always the same, regardless of the time zone… ??

Doc : [periodUntil](https://kotlinlang.org/api/kotlinx-datetime/kotlinx-datetime/kotlinx.datetime/period-until.html)

---

<div class="post-metadata">

**Author:** ![tlin47](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@tlin47](https://discuss.kotlinlang.org/u/tlin47)\
**Post date:** [May 6, 2023, 11:11pm UTC](https://discuss.kotlinlang.org/t/use-of-timezone-in-instant-perioduntil/26779/2 "2023-05-06T23:11:38Z")

</div>

The return type is DateTimePeriod which is not just a “simple” duration in one length-invariant unit, but also contains length-variant units, e.g. month.  
The length of different months is different and therefore the number of full months within a period can be different depending on when the period begins, i.e. which time zone is used.

Example:  
Look at the period 2023-02-28 22:00 UTC till 2023-03-29 22:00 UTC.  
That is a full month plus a day… at least in UTC. But go some timezones forward for the same instants: 2023-03-01 02:00 UTC+4 till 2023-03-30 02:00 UTC+4 and now it is two days less than a full month.

---

<div class="post-metadata">

**Author:** ![Ronron1024](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@Ronron1024](https://discuss.kotlinlang.org/u/Ronron1024)\
**Post date:** [May 9, 2023, 3:04pm UTC](https://discuss.kotlinlang.org/t/use-of-timezone-in-instant-perioduntil/26779/3 "2023-05-09T15:04:58Z")

</div>

Thank you @tlin47 !
