Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I get the millisecond for a date?

Mareli
Contributor
January 29, 2025

Good day, 

I am trying to get the miliseconds in a Date Text field.

I tried using the below

{{#now}}toMillis{{/}}


But it does not give it to me in date format.

3 answers

1 accepted

0 votes
Answer accepted
Mareli
Contributor
February 3, 2025

Hi All, 

I just wanted to extract the milliseconds. We needed it for reporting that we needed to do.

This was my solution: {{issue.created.format("yyyy-MM-dd HH:mm:ss")}} 

0 votes
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.
January 29, 2025

Hi @Mareli 

Please try this one:

{{#now}}format="toMillis"{{/}}

That may be chained with other function usage, such as this:

{{#issue.customfield_12345}}func=plusDays(2), format="toMillis"{{/}}

 

Kind regards,
Bill

Mareli
Contributor
January 30, 2025

Hello Bill, 

None of these worked. 

This is the result I get:

Screenshot 2025-01-30 at 12.30.56.png

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.
January 30, 2025

In your question, you asked about using the milliseconds format, which is an integer number since the start of Epoch time (i.e., a UNIX timestamp).

 

Returning to Trudy's question: what problem are you trying to solve?  And what would be an example date / time format that would help you solve that?

Knowing those will help the community offer better suggestions.  Thank you!

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 29, 2025

Hello @Mareli 

Can you provide a link to the reference document where you found toMillis? I'm not finding that in the documentation for Smart Values that can be used with date and time fields.

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

millis can be used as a unit of measure in the date/time difference function, and in the plus and minus functions to calculate a new date.

You aren't use either the diff or plus/minus functions.

What are you trying to accomplish with your calculation?

Matt Doar _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.
January 29, 2025

I seem to recall that Jira DC on MySQL doesn't use milliseconds in the database. Not sure if that applies in Cloud as well

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 3, 2025

@Mareli 

I just wanted to extract the milliseconds. We needed it for reporting that we needed to do.

This was my solution: {{issue.created.format("yyyy-MM-dd HH:mm:ss")}} 

If you look at the documentation for smart value functions/formatting for date/time values:

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

...there is a reference at the bottom of the formatting table to additional formatting commands in Java documentation.

https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html

According to that documentation you would use "S: to get fractions of a second. 

{{issue.created.format("yyyy-MM-dd HH:mm:ss:S")}} 

 

Screenshot 2025-02-03 at 10.44.37 AM.png

Suggest an answer

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

Upcoming Jira Events