# Perspective date time input - Can you add an option for current datetime?

**URL:** <https://forum.inductiveautomation.com/t/perspective-date-time-input-can-you-add-an-option-for-current-datetime/75415>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [June 22, 2023, 6:43pm UTC](https://forum.inductiveautomation.com/t/perspective-date-time-input-can-you-add-an-option-for-current-datetime/75415 "2023-06-22T18:43:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![r123](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@r123](https://forum.inductiveautomation.com/u/r123)\
**Post date:** [June 22, 2023, 6:43pm UTC](https://forum.inductiveautomation.com/t/perspective-date-time-input-can-you-add-an-option-for-current-datetime/75415/1 "2023-06-22T18:43:37Z")

</div>

I have a Perspective date time input with an onStartup script to give it the current datetime.

Would also like to have it zero the seconds if it can.

```auto
def runAction(self):
	from datetime import date
	self.props.value = system.date.now()

```

But manly I'd like the option to simply set it to the current datetime after the operator has set it to a few different dates.

Something like the "Today" option on the old MS Office DateTime Picker.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/e/5eec6b24467caf78e8e8ef83fe4b4d0e8b226bac.png)

---

<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:** [June 22, 2023, 6:48pm UTC](https://forum.inductiveautomation.com/t/perspective-date-time-input-can-you-add-an-option-for-current-datetime/75415/2 "2023-06-22T18:48:55Z")

</div>

There is no need to import `datetime`

If you want a date to have zero seconds that can be accomplished.

```auto
self.props.value = system.date.setTime(system.date.now(),hour,minutes,seconds)

```

The other is not a terrible Idea, you should create an Ideas post.

---

<div class="post-metadata">

**Author:** ![r123](https://avatars.discourse-cdn.com/v4/letter/r/838e76/32.png) [@r123](https://forum.inductiveautomation.com/u/r123)\
**Post date:** [June 22, 2023, 8:55pm UTC](https://forum.inductiveautomation.com/t/perspective-date-time-input-can-you-add-an-option-for-current-datetime/75415/3 "2023-06-22T20:55:59Z")

</div>

This seems to work:

```auto
def runAction(self):
	date = system.date.now()
	self.props.value = system.date.setTime(system.date.now(),system.date.getHour24(date),system.date.getMinute(date),0)

```

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 22, 2023, 9:17pm UTC](https://forum.inductiveautomation.com/t/perspective-date-time-input-can-you-add-an-option-for-current-datetime/75415/4 "2023-06-22T21:17:46Z")

</div>

An expression binding of `now(0)` will run once on startup so you can use this in any of the date/time inputs to set the date. e.g.,

```auto
midnight(now(0))

```

For your application you want something like,

```auto
setTime(
	now(0), 
	getHour24(now(0)), 
	getMinute(now(0)), 
	0
)

```

[https://docs.inductiveautomation.com/display/DOC81/Date+and+Time](https://docs.inductiveautomation.com/display/DOC81/Date+and+Time)
