Working days between two dates

How can I calculate number of working days between two dates. It should use the jira configuration in jira where we specify working days.

2 answers

0 votes
componentManager.getJiraDurationUtils().getFormattedDuration(remaining)

Well, that will convert a long to days based on the information you have put into timetracking.

To get working days between two dates you might need to dig into the greenhopper config, where you can specify what are not working days.

To get days between two dates I have used jodatime API which is already in jira classpath. But I am looking for a utility which just takes weekends (jira configuration of working days) into consideration while calculating days between

JqlQueryBuilder builder = JqlQueryBuilder.newBuilder();

createdBetween(startDate, endDate)

now you have the result from start date to end date.

you just set the date format by using formater.

now you can long milliseconds1 = startDate.getTimeInMillis();
long milliseconds2 = endDate.getTimeInMillis();
long diff = milliseconds2 - milliseconds1;
long diffSeconds = diff / 1000;
long diffMinutes = diff / (60 * 1000);
long diffHours = diff / (60 * 60 * 1000);
long diffDays = diff / (24 * 60 * 60 * 1000);
System.out.println("\nThe Date Different Example");
System.out.println("Time in milliseconds: " + diff
+
" milliseconds.");
System.out.println("Time in seconds: " + diffSeconds
+
" seconds.");
System.out.println("Time in minutes: " + diffMinutes
+
" minutes.");
System.out.println("Time in hours: " + diffHours
+
" hours.");
System.out.println("Time in days: " + diffDays
+
" days.");

you can get expected result.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Featured Groups

Tuesday tips & tricks: What is the Atlassian Community?

It's officially Tuesday, which means it's officially time for another tip to help you better navigate this space we call the Atlassian Community. 😄 I got a great question from community member, Sa...

108 views 4 8
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you