Java tutorial
import java.time.OffsetDateTime; import java.time.ZoneId; import java.time.temporal.ChronoUnit; public class Main { public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.now(); long d = o.until(OffsetDateTime.now(ZoneId.systemDefault()), ChronoUnit.WEEKS); System.out.println(d); } }