Good morning I am trying to add a few days to days without counting Saturdays and Sundays when it gets to Friday, the day increases but the result is Saturday afterwards it does not do anything for the condition of the if ():
while (dias<=num_dias_afectar)
{
if (fechaInicialcalendar.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && fechaInicialcalendar.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY)
{
fechaInicialcalendar.add(Calendar.DATE, 1);
Date fecha_fin = fechaInicialcalendar.getTime();
fecha_termino = format.format(fecha_fin);
dias++;
}
}
How can I prevent the result from being Saturday or in other cases the result is Monday?