Forum Discussion
SmartBear_Suppo
Alumni
13 years agoHere's some Groovy code which will store the next Saturday or Sunday in the variable nonWorkingDay:
def calendar = Calendar.getInstance()
def dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK)
def offset = Calendar.SATURDAY - dayOfWeek
if (offset > 0) calendar.add(Calendar.DAY_OF_WEEK, offset )
def nonWorkingDay = calendar.time
def calendar = Calendar.getInstance()
def dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK)
def offset = Calendar.SATURDAY - dayOfWeek
if (offset > 0) calendar.add(Calendar.DAY_OF_WEEK, offset )
def nonWorkingDay = calendar.time