Sumar dias habiles / Working days

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
def suma_dias_habiles(fecha_origen, dias):
    h = dias
    ds = 5 - fecha_origen.weekday() # distancia al sabado
    s = 0
    if h >= ds: 
        s = s + 2
        h = h - ds
        
    s = s + h / 5 * 2
    return datetime.date.fromordinal( fecha_origen.toordinal() + dias + s )

More like this

  1. SelectDateWidget with format: day, month, year by zenx 2 years, 1 month ago
  2. DateTimeFluxCapacitor by jbcurtin 1 year ago
  3. Timedelta template tag by dballanc 4 years, 9 months ago
  4. Past days template filter by ramen 2 years, 2 months ago
  5. Naked CSS Day TemplateTag by webology 2 years, 10 months ago

Comments

(Forgotten your password?)