code: public static int weekday(EvaluationContext ctx, Object date) {
          int iso = Conversions.toDateOrDateTime(date, ctx).get(ChronoField.DAY_OF_WEEK);
          return iso < 7 ? iso + 1 : 1;
      }
docs: Returns the day of the week of a date (1 for Sunday to 7 for Saturday)