Groovy web console

subscribe to the feed Subscribe
to this
site
NRF Calendar dates (via #groovywebconsole)
tweet this snippet Tweet
this
script

NRF Calendar dates

Published 3 weeks ago by Yikuno Barnaby with tags NRF Calendar NRF Calendar Retail Calendar Retail
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
// Get Sunday's date and Saturday's date from last week 
//to be plugged into Mysql range query.
//Tgus us 
def c = Calendar.instance
def dateArray = [] as ArrayList
c.add(Calendar.DATE, -7)
c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
for(int date in Calendar.SUNDAY..Calendar.SATURDAY){
        dateArray[date] = c.getTime().format("yyyy-MM-dd")
     c.add(Calendar.DATE, 1)
}
println dateArray[1]
println dateArray[7]