1

Here is a code snippet:

public static void main(String[] args) {
        // TODO code application logic here
        long oneMonthAgo=30*24*60*60*1000;
        Date now = new Date();
        Date twf=new Date(now.getTime()-oneMonthAgo);
        System.out.println(twf.before(now));
    }

This outputs false

While this code snippet:

public static void main(String[] args) {
        // TODO code application logic here
        long twentyDaysAgo=20*24*60*60*1000;
        Date now = new Date();
        Date twf=new Date(now.getTime()-twentyDaysAgo);
        System.out.println(twf.before(now));
    }

Output: True

Isnt it strange enough ?

rahulserver
  • 10,411
  • 24
  • 90
  • 164

0 Answers0