# system.perspective.openPopup() with Date Parameter

**URL:** <https://forum.inductiveautomation.com/t/system-perspective-openpopup-with-date-parameter/36884>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [July 21, 2020, 12:11am UTC](https://forum.inductiveautomation.com/t/system-perspective-openpopup-with-date-parameter/36884 "2020-07-21T00:11:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhines](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@bhines](https://forum.inductiveautomation.com/u/bhines)\
**Post date:** [July 21, 2020, 12:11am UTC](https://forum.inductiveautomation.com/t/system-perspective-openpopup-with-date-parameter/36884/1 "2020-07-21T00:11:52Z")

</div>

I have a popup view with a parameter named "startDate" which is bound to a DateTime Input component on the popup view.

For testing purposes, I have another view with two buttons: one that uses the Popup action to open the popup view with the "startDate" set to the value of a DateTimePicker component on the test view, and another that uses the system.perspective.openPopup() function with the "startDate" parameter set to a date obtained with the system.date.getDate() function. Following is a snippet of the script:

> startDate = system.date.getDate(2020, 6, 4)  
> system.perspective.openPopup("myPopupView",'PopupView', params = {'startDate':startDate}, showCloseIcon = True, modal = True)

When I show the popup view with the Popup action button, everything works as expected, i.e., the DateTime Input has the value specified in the parameter "startDate". When I show the popup view with the system.perspective.openPopup() function, the DateTime Input does not have a value.

Does anyone have an idea of what I may be doing wrong in the latter case?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [July 21, 2020, 3:41am UTC](https://forum.inductiveautomation.com/t/system-perspective-openpopup-with-date-parameter/36884/2 "2020-07-21T03:41:22Z")

</div>

> [@bhines](#):
>
> startDate = system.date.getDate(2020, 6, 4)  
> system.perspective.openPopup(“myPopupView”,‘PopupView’, params = {‘startDate’:startDate}, showCloseIcon = True, modal = True)

It looks like the format the date is returned in from `getDate()` is not a format the DateTime Input will accept for its value.

Expected format: `1594926000000` (Unix time stamp, which we pretty-print as a Date object)  
What you're providing from `system.date.getTime()`: Java Date Object.

Try this:

```auto
startDate = system.date.getDate(2020, 6, 4).getTime()
system.perspective.openPopup("myPopupView","PopupView", params={"startDate":startDate}, showCloseIcon=True, modal=True)

```

---

<div class="post-metadata">

**Author:** ![bhines](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@bhines](https://forum.inductiveautomation.com/u/bhines)\
**Post date:** [July 21, 2020, 12:53pm UTC](https://forum.inductiveautomation.com/t/system-perspective-openpopup-with-date-parameter/36884/3 "2020-07-21T12:53:47Z")

</div>

That does the trick. Thanks for the help!
