I am having scenario with my property file input like below for weekly reports
Data lag - 10 days
Run day - Tuesday.
The requirement is based on the date lag: I have to move the calendar 10 days back. Then I want to find the Tuesday (any weekday may be specified in a parameter).
From that I want to get a weekly report.
When this config specified, say example today 11-may 2021
11 May - 10 days = 01 May 2021. After this based on the run day (for example Monday), my calendar should move to 26 April.
The final result will be
(Monday) 26 April to (Sunday) 02 May.
val format_w = new SimpleDateFormat("yyyy-MM-dd")
val cal_ins = Calendar.getInstance
cal_ins.add(Calendar.DATE, -datalaginterval)
val datlag_date = cal_ins.getTime()
logger.info("datalag date"+datlag_date)
cal_ins.add(Calendar.DATE, -7)
val startdate = cal_ins.getTime
val start_date = format_w.format(startdate)
println("start date-"+start_date)
// calculate sunday last week (moves cal 6 days fwd)
cal_ins.add(Calendar.DATE, 6)
val enddate = cal_ins.getTime
val end_date = format_w.format(enddate)
println("End date-"+end_date)
I am using the Java Calendar
class.