On Jira cloud, without using Script Runner or other plugins, is there a way to extract just the date portion of a date-time picker field and store it in a different custom date field? For example, if the date-time field is set to 4-10-2019 8PM EST the extracted date should be 4-10-2019 and not be rounded off to 4-11-2019.
Hi Deepa,
If I understand your concern here is in regards to copying a date/time field value into a date field, and in doing so, sometimes the date appears to be getting incremented by 1 day or rounded off instead of using the same day.
I think I know what is happening here at least. The problem comes down to the way Jira stores these values and timezones. For both date/time and just date fields, Jira is storing these in SQL as complete unix date/time values complete with timezone elements. The problem here because the Jira site itself is using the timezone of the operating system it was launched with, but when this timezone is one or more hours ahead of the end user's profile timezone, the actual value being stored in SQL appears to be a day ahead here.
I was able to replicate this in my own Jira Cloud site. In my setup I created two fields, datetime1 and dateonly1, added these to my screens of my project, then created a post function in the workflow to copy the value of datetime1 to dateonly1 when this specific transition was executed, and published the workflow.
In my testing, I found that my dates worked for all times before 7PM. All times at or after 7PM show the next day instead in the dateonly1 field. This is happening because my user profile is 5 hours behind the timezone that the Jira system is using. I don't have an easy way for you to find your Jira system timezone in a Cloud instance. It sounds like it's at least 4 hours in your case, it could be more. You might want to play with this a bit to figure out the exact time difference in your case.
If you were using Jira Server, I would recommend taking a closer look at the KB Setting the timezone for the JAVA environment. In a server environment, you could set a jvm startup argument to have the server timezone use the same value as your profile timezone. This could work for your user account in Server, but could cause other time problems for other users. However because you are in Cloud, this method won't help because we can't set such JVM startup arguments in Jira Cloud instances. I also reached out to my Cloud Support team and they confirmed that it is not currently possible to set the timezone of the Jira system in Cloud.
One way I found I could work-around this was to change my timezone in my personal settings: (Go to your Avatar in the bottom left -> Personal Settings). My value here was set to GMT -06:00 Chicago. I changed it to GMT -1:00 Scoresbysund. When I then refreshed my issue, I found other date/times appear shifted like create date/time and resolved date/time. However I found then that running my transition/post-function always appear to work the way I would expect for this specific field to field copy.
I realize this work-around is not ideal and can be rather tedious. It also would only help the users that are in the same timezone as the Jira system timezone. Meaning that other users in different timezones could still see this problem.
Sorry I don't have a perfect solution here. But does this help at all?
Andy
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.