fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. import java.time.* ;
  8. import java.time.temporal.* ;
  9.  
  10. /* Name of the class has to be "Main" only if the class is public. */
  11. class Ideone
  12. {
  13. public static void main (String[] args) throws java.lang.Exception
  14. {
  15. System.out.println(
  16. LocalDate
  17. .now( ZoneId.of( "Africa/Tunis" ) )
  18. .with( Ideone.nextMarch14() )
  19. .toString()
  20. );
  21.  
  22. }
  23.  
  24. public static TemporalAdjuster nextMarch14 ( )
  25. {
  26. return ( Temporal temporal ) -> {
  27. MonthDay march14 = MonthDay.of( 3 , 14 );
  28. Temporal then = temporal.with( march14 );
  29. if ( ChronoUnit.DAYS.between( temporal , then ) < 0 )
  30. {
  31. then = then.plus( Period.ofYears( 1 ) );
  32. }
  33. return then;
  34. };
  35. }
  36. }
Success #stdin #stdout 0.16s 52060KB
stdin
Standard input is empty
stdout
2023-03-14