[Scripr runner cloud] Get quarter of the year based on date

Sebastian Krzewiński
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 11, 2024

Hi!

 

Is there any way to get quarter of the year based on date in script runner?

I can set format for year/month/date like year=today.format("YYYY") and maybe there is something like quater=today.format("Q").

 

Regards,

Seba

1 answer

1 accepted

0 votes
Answer accepted
Sean Chua _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.
April 11, 2024

Hey @Sebastian Krzewiński ,

I don't think there is a specific one like that, but if you have some kind of logic to define it nicely, it should be possible for you to format it in a way that it looks like "YYYY, QX"

I mean, if you wanted to display it in a scripted field, you could possibly define something like:

    def quarter    if (month >= 1 && month <= 3) {
        quarter = "Q1"
    } else if (month >= 4 && month <= 6) {
        quarter = "Q2"
    } else if (month >= 7 && month <= 9) {
        quarter = "Q3"
    } else if (month >= 10 && month <= 12) {
        quarter = "Q4"

 Let me know how that works out for you.

Regards,

Sean

Sebastian Krzewiński
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 12, 2024

Hi @Sean Chua _Adaptavist_ 

 

 

Thanks for an info. I solved that yesterday in very similar way.

Thanks!

Like Sean Chua _Adaptavist_ likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events