Groovy web console

subscribe to the feed Subscribe
to this
site
Date test (via #groovywebconsole)
tweet this snippet Tweet
this
script

Date test

Published 2 months ago by mml with tags test
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
long current = System.currentTimeMillis();
long oldestDate = current - (43200 * 60 * 1000);
System.out.println("current:  " + current);
System.out.println("oldestDate: " + oldestDate);

java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("YYYY-MM-DD");  

System.out.println("current:  " + sdf.format(current));
System.out.println("oldestDate: " +  sdf.format(oldestDate));