Groovy web console

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

Date Sample

Published 4 months ago by Shayne L with tags date sample
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
Date now = new Date()
Calendar myCalendar = Calendar.getInstance()
myCalendar.setTime(now)
String year = myCalendar.get(Calendar.YEAR)
String day = myCalendar.get(Calendar.DAY_OF_YEAR)

"D${year[2]}${year[3]}${day}"