# Don't understand date formatting, why it shows wrong date?

**URL:** <https://community.weweb.io/t/dont-understand-date-formatting-why-it-shows-wrong-date/7355>\
**Category:** Ask us anything\
**Created:** [March 1, 2024, 2:04am UTC](https://community.weweb.io/t/dont-understand-date-formatting-why-it-shows-wrong-date/7355 "2024-03-01T02:04:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![raelyn](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raelyn/32/2803_2.png) [@raelyn](https://community.weweb.io/u/raelyn)\
**Post date:** [March 1, 2024, 2:04am UTC](https://community.weweb.io/t/dont-understand-date-formatting-why-it-shows-wrong-date/7355/1 "2024-03-01T02:04:01Z")

</div>

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/0/08535fe4eb65141f7fc0b247ded7b125762cb8c1.png)

I have a formula like such that gives me a date.

But when I try to format it to YYYY-MM-DD, it gives me 2024-07-21 and not 2024-07-20. Why? How do I get it to show the correct date?

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/a/a569391b104aeb4607978372b9ff0b99dddeb64b.png)

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [March 1, 2024, 6:52am UTC](https://community.weweb.io/t/dont-understand-date-formatting-why-it-shows-wrong-date/7355/2 "2024-03-01T06:52:26Z")

</div>

what timezone are you in?

---

<div class="post-metadata">

**Author:** ![raelyn](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raelyn/32/2803_2.png) [@raelyn](https://community.weweb.io/u/raelyn)\
**Post date:** [March 1, 2024, 9:06am UTC](https://community.weweb.io/t/dont-understand-date-formatting-why-it-shows-wrong-date/7355/3 "2024-03-01T09:06:07Z")

</div>

GMT+8. Does it matter?

---

<div class="post-metadata">

**Author:** ![raydeck](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raydeck/32/384_2.png) [@raydeck](https://community.weweb.io/u/raydeck)\
**Post date:** [March 1, 2024, 2:16pm UTC](https://community.weweb.io/t/dont-understand-date-formatting-why-it-shows-wrong-date/7355/4 "2024-03-01T14:16:55Z")

</div>

Yes. “Z” means the time zone is Greenwich Mean Time (so-called “Zulu time”). So 1600 hours (4pm) in Greenwich, England is 0000 hours (midnight, because 16+8 = 24) in your local time.

formatDate uses your local time zone to convert a universal timestamp to your local representation.

If the 20 is correct, you might instead of using a date function, use subtext with a start of 0 and length of 10. (The first 10 characters of your existing ISO representation being 2024-07-20)
