# Update the perspective date component as per system date

**URL:** <https://forum.inductiveautomation.com/t/update-the-perspective-date-component-as-per-system-date/56360>\
**Category:** Ignition\
**Tags:** ignition80, perspective, ignition81, scripting\
**Created:** [February 21, 2022, 11:51am UTC](https://forum.inductiveautomation.com/t/update-the-perspective-date-component-as-per-system-date/56360 "2022-02-21T11:51:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arun\_Teja\_Gattu](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@Arun\_Teja\_Gattu](https://forum.inductiveautomation.com/u/Arun_Teja_Gattu)\
**Post date:** [February 21, 2022, 11:51am UTC](https://forum.inductiveautomation.com/t/update-the-perspective-date-component-as-per-system-date/56360/1 "2022-02-21T11:51:32Z")

</div>

The perspective date component needs to be updated based on the system date i.e. regional format and country.  
Do we have any functions or scripting to get the work done in perspective?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [February 21, 2022, 12:50pm UTC](https://forum.inductiveautomation.com/t/update-the-perspective-date-component-as-per-system-date/56360/2 "2022-02-21T12:50:20Z")

</div>

Any of the `system.date` functions return localized dates so long as the locale is set appropriately.

Any of the Date expressions should also return the localized date.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 21, 2022, 1:19pm UTC](https://forum.inductiveautomation.com/t/update-the-perspective-date-component-as-per-system-date/56360/3 "2022-02-21T13:19:49Z")

</div>

> [@lrose](#):
>
> return localized dates

Uhm, no. They return instances of `java.util.Date`, which carry neither localization nor time zone themselves. Localization is applied _ **from the VM state** _ when converting to/from strings.

Some of Perspective's various components can take dates delivered to the front end in UTC millis format (the underlying format of `java.util.Date`) and apply the browser's localization. For all else, since Perspective's scripts run in the gateway, the script author must deliberately work with java's timezone objects initialized from the session's timezone to perform string conversions correctly (manually).

---

<div class="post-metadata">

**Author:** ![Arun\_Teja\_Gattu](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@Arun\_Teja\_Gattu](https://forum.inductiveautomation.com/u/Arun_Teja_Gattu)\
**Post date:** [February 22, 2022, 5:39am UTC](https://forum.inductiveautomation.com/t/update-the-perspective-date-component-as-per-system-date/56360/4 "2022-02-22T05:39:44Z")

</div>

Hi all,  
Is there any way to change timezone of gateway or perspective for testing purposes.  
Like an example: The timezone which we are getting is ‘Asia/Calcutta’. Even After changing in the session paramter,browser timezone as well as system timezone it is still retuning the same timezone i.e, ‘Asia/calcuatta’.

---

<div class="post-metadata">

**Author:** ![Arun\_Teja\_Gattu](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@Arun\_Teja\_Gattu](https://forum.inductiveautomation.com/u/Arun_Teja_Gattu)\
**Post date:** [February 22, 2022, 9:08am UTC](https://forum.inductiveautomation.com/t/update-the-perspective-date-component-as-per-system-date/56360/5 "2022-02-22T09:08:20Z")

</div>

Hi All,…Our requirement is to display the Date format according to system locale (en-us,en-uk etc) for different regions…Is this possible with Ignition’s available features/properties?

en-us —\>02/22/2022  
en-uk—\> 22/02/2022  
etc

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 22, 2022, 1:05pm UTC](https://forum.inductiveautomation.com/t/update-the-perspective-date-component-as-per-system-date/56360/6 "2022-02-22T13:05:52Z")

</div>

Yes, your scripts can take the UTC milliseconds from the `java.util.Date` Ignition uses and make a `java.time.Instant` with its static method [.ofEpochMilli()](https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html#ofEpochMilli-long-). Then, obtain a `java.time.ZoneId`, usuallly by lookup with [.of()](https://docs.oracle.com/javase/8/docs/api/java/time/ZoneId.html#of-java.lang.String-). With those two, you can obtain a `java.time.ZonedDateTime` with its [.ofInstant()](https://docs.oracle.com/javase/8/docs/api/java/time/ZonedDateTime.html#ofInstant-java.time.Instant-java.time.ZoneId-) method.

That can then be formatted numerous ways, all respecting the given `ZoneId`.
