Forums

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

Converting Time to Nanoseconds (JSON)

mike_atrache
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 18, 2026

I’m sending a JSON payload to the Datadog DORA metrics API, which requires the timestamp to be in nanoseconds. What is the best way to format or convert time value to nanoseconds within this JSON structure (started_at & finished_at)? 

{
"data": {
"attributes": {
"team": "retails",
"service": "portal",
"env": "production",
"started_at": {{issue.customfield_12138.epochMilli}},
"finished_at": {{issue.customfield_12140.epochMilli}},
"severity": "{{issue.priority.name}}",
"name": "{{issue.key}} : {{issue.summary}}"
}
}
}


Required format: 1693491974000000000

(Human-readable date: Thursday, August 31, 2023 2:26:14 PM (UTC))

 

1 answer

1 vote
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 Champions.
January 18, 2026

Hi @mike_atrache -- Welcome to the Atlassian Community!

Are you trying this in an automation rule?  If so...

When I have tried this in the past, the format() function with nano-of-second did not work in a rule.  A workaround is to create a variable for the start of epoch time (i.e., start of day 1 Jan 1970) and then perform a diff() to millis format, multiplying as needed for nanoseconds.

An example for the start of epoch time would be this:

{{now.withYear(1970).withDayOfYear(1).toDateTimeAtStartOfDay}}

Then an example of the diff() would be this, assuming the variable is named varStartOfTime:

{{varStartOfTime.toDate.diff(issue.customfield_12138).millis}}


Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events