Need help on automation with dates
Asked by Rosana Casilli:

Hi all!

One of the project lead wants to classify some issue taking into account the hour and minute of the date created.

IF the issue was created after 19hs 00 min

then

update customefieldx= Yes

else

update customefieldx= No

How can I do that comparission?

Thanks in advance

Ro


Answers:
author: Bill Sheboy
body: Hi [@Rosana Casilli](/t5/user/viewprofilepage/user-id/1660030)

The rule could use the date / time function format() to get the hour from the created date / time, and then use rule conditions on the result. Please look here to find additional options for that function: <https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-format--->

Kind regards,  
Bill

comments: author: Dave Rosenlund _Trundl_
body: Also, check out this previous post and the answer provided by [Mark Segall](https://community.atlassian.com/t5/user/viewprofilepage/user-id/4666637) in the thread below.

I just threw away a suggested solution I was working on because I remembered to search the community first, and I see now that Mark is much smarter than I am. And so is Bill byh the way. ?

[**Solved: Check is time is between range of time - Jira autoamtion**](https://community.atlassian.com/t5/Jira-questions/Check-is-time-is-between-range-of-time-Jira-autoamtion/qaq-p/2378559)

Best,

-dave


author: Rosana Casilli
body: Hi [@Dave Rosenlund _Trundl_](/t5/user/viewprofilepage/user-id/1164057) !! thank you for your response...

I have tried to use what it is mentioned in that post.. but... I do not know why, the Hour and minute it is always showing the same value

I create a rule (on create issue) where I compare this two values:

if {{issue.created.convertToTimeZone("America/Argentina/Buenos_Aires").format("H")}} equals 13

and

{{issue.created.convertToTimeZone("America/Argentina/Buenos_Aires").format("M")}} greater than 7

then

Edit issue, and here I update a field.

Since I tested and didn?t change the value when "I supposed" the condition was true, then before the condition I put a send mail with the values in the condition. What i see is at the time the issue is created, that the values for {{issue.created.convertToTimeZone("America/Argentina/Buenos_Aires").format("H")}} is 13 (that is correct), and the value for {{issue.created.convertToTimeZone("America/Argentina/Buenos_Aires").format("M")}} is 5

but the created date has 13:07

It doesn't matter how many times I create an issue ( in different minutes difference) the values that returns those smart values are always the same, it is always showing 13 and 5

Can you help me with this?

Thanks in advance,

Ro


author: Dave Rosenlund _Trundl_
body: I'm sorry to say that we've exceeded my Automation expertise, [@Rosana Casilli](/t5/user/viewprofilepage/user-id/1660030) . Maybe [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) will know.

He's a wizard, whereas I'm just a novice.


author: Bill Sheboy
body: For the format() function, "H" is the hour-of-the-day and "M" is the month-of-the-year.

Did you want to use "m" for minute-of-the-hour instead?


author: Rosana Casilli
body: Thank you both [@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) and [@Dave Rosenlund _Trundl_](/t5/user/viewprofilepage/user-id/1164057)

a big mistake from my side!! it works!


Tags: cloud

jira-service-management

jira-service-management-cloud