Outils pour utilisateurs

Outils du site


personnel:java:localdate

Ceci est une ancienne révision du document !


import java.time.LocalDate; import java.time.temporal.ChronoUnit;

/ * * @author bogusz.thierry */ public class JavaApplication12 { /

  • @param args the command line arguments
  • /

public static void main(String[] args) {

      // TODO code application logic here
     
      
      LocalDate h1 = LocalDate.parse("2022-01-02");
      LocalDate h2 = LocalDate.parse("2022-01-20");

long m1;

      m1 = h1.until(h2,ChronoUnit.DAYS);//18 jours
      
      LocalDate dateJour = LocalDate.now();
      long m2 = h1.until(dateJour, ChronoUnit.DAYS);

System.out.println(m1 + “:” + m2);

      
  }
  

}

personnel/java/localdate.1646843566.txt.gz · Dernière modification: 2022/03/09 17:32 de thbogusz