Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to change "Date Picker" to "Date Time Picker"

Lakshmi CH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2023

Hi Team,

Is it possible to change a field's type from "Date Picker" to "Date Time Picker" using Scriptrunner without deleting the existing fields?

1 answer

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2023

You can, but only by direct database editing.  Code can't do it directly.

With code, you could create a new screen, and write a script that can copy the date in the old field over into the new.

Date and date-time fields are the same thing in the database, and have very similar code.  In the database, the columns are the same time - date/time stamps.  If you looked at a date field, it does have a time attached, but you'll see that the time is always midnight (00:00:00). 

So you would not need to change the data, all you need to do is stop the Jira, take a database backup, change the type of field in the custom field header, restart Jira, go edit the custom field, changing its searcher to the best one for you (in fact, make sure you change it to something else, and save the field, then go back in and change it to the one you actually want.

Finally, do a full re-index, and it'll all work.

Going from date/time to just date is the same, but you can run into problems with it in some places if you have data that you don't remove the time from them.

Suggest an answer

Log in or Sign up to answer