Forums

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

Concatenating fields into a single date/time field

George Tsemberlis August 6, 2025

Hi there,

For reasons that predate my involvement, there is a single select field that exists in our instance that consists of a bunch of times, eg "3:00 PM"

I'd like to  backfill via an A4J rule to combine these with an existing date field into a new single Date/Time Field but am having difficulty getting the values of both of these fields into something that Jira will accept as a valid entry for a date/time field.

 

Any advice? 

1 answer

1 accepted

0 votes
Answer accepted
Bill Sheboy
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.
August 6, 2025

Hi @George Tsemberlis 

Without seeing the specifics of your rule for context...

There are several ways to do this using date / time functions:

  1. Parse the date and time values as text, merge them, and then convert with the toDate() function and the specific format.  I would try this way first.
  2. Parse the time value into parts, and use the with[Attribute] functions to set the hour, minute, etc. for the date
  3. Parse the date, and use with[Attribute] to combine to the time (i.e., this is the opposite of #2 above)

 

Kind regards,
Bill

George Tsemberlis August 6, 2025

How my rule is currently:
- Take {{issue.Time Field.value}} as a variable {{TimeToString}}, logs correctly as "11:30 PM"
- Take Date as  {{issue.Date Field.JiraDate}} as a variable {{DateToString}}, logs as 2025-08-25

When I try to put them together I have them going into the Date/Time Field as {{DateToString}}{{TimeToString}}

 

What's the context for the toDate() function given the above?

Bill Sheboy
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.
August 6, 2025

Here is the documentation for that function: 

https://support.atlassian.com/cloud-automation/docs/examples-of-using-smart-values-with-dates/#Converting-text-to-dates

 

You may try letting the rule "guess" the format with just toDate() or to specify it exactly, such as with:

{{varSomeVariable.toDate("yyyy-MM-dd hh:mm a")}}

 

Please see the date / time format function to learn more about possible formats to supply based on the Java documentation: 

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-format---

George Tsemberlis August 12, 2025

Amazingly letting it "Guess" ended up working better than trying to strictly parse it out before sending everything into the field, thanks!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
ENTERPRISE
TAGS
AUG Leaders

Atlassian Community Events