@Shivi Gupta try to use this code:
import java.sql.Timestamp
import java.time.LocalDate
import java.time.ZoneId
Timestamp created = isssue.getCreated()
LocalDate createdDate = created.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()LocalDate result = createdDate;
int
addedDays =
0
int days = 3while
(addedDays < days) {
result = result.plusDays(
1
);
if
(!(result.getDayOfWeek() == DayOfWeek.SATURDAY || result.getDayOfWeek() == DayOfWeek.SUNDAY)) {
++addedDays;
}
}
Timestamp dueDate =Timestamp.valueOf(result.atStartOfDay());
issue.setDuedate(dueDate)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Shivi Gupta I tried to fix the code, give it a try, please
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you elaborate on what context we're looking at here? Is it for a post-function? Which one?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try something like this (+8 Hours in my case):
def date = new Date();
Calendar calendar = Calendar.getInstance();
date=calendar.getTime();
calendar.add(Calendar.HOUR_OF_DAY, 8)
if(calendar.get(Calendar.DAY_OF_WEEK)==7)
{
calendar.add(Calendar.DAY_OF_MONTH, 2)
}
if(calendar.get(Calendar.DAY_OF_WEEK)==1)
{
calendar.add(Calendar.DAY_OF_MONTH, 1)
}
date=calendar.getTime();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.