Example:
Days = 3d
Creation date = 17/06/2020
Due date = 22/06/2020 (exclude non working days )
@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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.