# Vision power table date picker format

**URL:** <https://forum.inductiveautomation.com/t/vision-power-table-date-picker-format/60412>\
**Category:** General Discussion\
**Tags:** ignition80, vision\
**Created:** [June 6, 2022, 4:05pm UTC](https://forum.inductiveautomation.com/t/vision-power-table-date-picker-format/60412 "2022-06-06T16:05:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael.benson](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@michael.benson](https://forum.inductiveautomation.com/u/michael.benson)\
**Post date:** [June 6, 2022, 4:05pm UTC](https://forum.inductiveautomation.com/t/vision-power-table-date-picker-format/60412/1 "2022-06-06T16:05:38Z")

</div>

on a power table when you select a date in a cell with the date picker i want to know if you can change it so it uses 24 hours (military time)

---

<div class="post-metadata">

**Author:** ![LCao](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lcao/32/35341_2.png) [@LCao](https://forum.inductiveautomation.com/u/LCao)\
**Post date:** [June 8, 2022, 4:09pm UTC](https://forum.inductiveautomation.com/t/vision-power-table-date-picker-format/60412/2 "2022-06-08T16:09:03Z")

</div>

Hi Michael,

Unfortunately, the date picker format is not editable at this point. But I can see how your request would have its use cases. Feel free to submit your feature request via the Idea’s page - [Ignition Features and Ideas | Inductive Automation](https://ideas.inductiveautomation.com/ignition-features-and-ideas)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [May 22, 2023, 7:48am UTC](https://forum.inductiveautomation.com/t/vision-power-table-date-picker-format/60412/3 "2023-05-22T07:48:34Z")

</div>

> [@LCao](#):
>
> the date picker format is not editable at this point

While doing some idle reading of older forum posts over the weekend, I ran across this cold case, and it looked interesting. With Vision, if there isn't a built in way to do something, it's usually doable with scripting.

Here is a script that will add a listener to the button that generates the datepicker, and will automatically correct the datepicker's format when the popup window is opened:

```auto
#def initialize(self):
	from java.awt import Window
	from java.awt.event import ActionListener
	from java.util import Date
	from java.text import SimpleDateFormat
	from com.jidesoft.swing import ResizableWindow
	from javax.swing import JFormattedTextField, JSpinner
	from javax.swing.plaf.synth import SynthArrowButton
	powerTable = self
	class DateEditListener(ActionListener):
	    def actionPerformed(self, actionEvent):
			def getJSpinner(window):
				for component in window.getComponents():
					if isinstance(component, JFormattedTextField) and 'JSpinner$DateEditor' in str(component.parent. __class__ ):
						return component.parent.spinner
					jspinner = getJSpinner(component)
					if jspinner is not None:
						return jspinner
			openDateWindows = [window for window in Window.getWindows() if isinstance(window, ResizableWindow) and window.isVisible()]
			jspinner = next((getJSpinner(window) for window in openDateWindows if getJSpinner(window) is not None), None)
			if jspinner is not None:
				format = SimpleDateFormat("HH:mm")
				newDateEditor = JSpinner.DateEditor(jspinner, format.toPattern())
				jspinner.setEditor(newDateEditor)
	for column in range(powerTable.data.columnCount):
		if powerTable.table.getColumnClass(column).isAssignableFrom(Date):
			for component in powerTable.table.columnModel.getColumn(column).getCellEditor().comboBox.getComponents():
				if isinstance(component, SynthArrowButton):
					component.addActionListener(DateEditListener())

```

**Result:**  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/c/5c0ab231553fb8317a9ed6920016b0c68cbc9ac1.png)  
This should be ran from the power table's initialize extension function. It should be noted that this extension function will not run in the designer.
