Problem with date format

Problem with date format

Hi

I use the snippet


  1. for each  echeance in echeancierList
    {
        dueDate0 = echeance.getJson("Echeance_dt");
        dueDate = dueDate0.tostring("YYYY-MM-dd");
        info "input : "+dueDate0;
        info "output :"+dueDate;
  2. }

expected result
  1. input : 31/01/2024
  2. output : 2024/01/31 (yyyy-mm-dd)
  3. input : 01/03/2024
  4. output : 2024/03/01 (yyyy-mm-dd)

Below is the result (it is Ok for the 1rst ,  but for the 2nd item there is an inapropriate result)

  1. input : 31/01/2024
  2. output : 2024/01/31 (yyyy-mm-dd)
  3. input : 01/03/2024
  4. output : 2024/01/03 (yyyy-dd-mm)


what is wrong whith this snippet ?