Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am stuck at something it might be very simple.
I am defining a variable "currentDate" as :
Date currentDate = TalendDate.addDate(TalendDate.getCurrentDate(),- 3,"dd");
but I would like to set it as : if it is 8 am then it should be
TalendDate.addDate(TalendDate.getCurrentDate(),- 3,"dd") else TalendDate.addDate(TalendDate.getCurrentDate(),- 1,"dd")
Could someone help me please?
thanks a lot
Hi
Try this on tJava:
Calendar calendar = Calendar.getInstance();
calendar.setTime(TalendDate.getCurrentDate());
int hour = calendar.get(Calendar.HOUR_OF_DAY);
if(hour==8){
context.currentDate=TalendDate.addDate(TalendDate.getCurrentDate(),- 3,"dd")
}else{
context.currentDate=TalendDate.addDate(TalendDate.getCurrentDate(),- 1,"dd")
}
Regards
Shong
Hi
Try this on tJava:
Calendar calendar = Calendar.getInstance();
calendar.setTime(TalendDate.getCurrentDate());
int hour = calendar.get(Calendar.HOUR_OF_DAY);
if(hour==8){
context.currentDate=TalendDate.addDate(TalendDate.getCurrentDate(),- 3,"dd")
}else{
context.currentDate=TalendDate.addDate(TalendDate.getCurrentDate(),- 1,"dd")
}
Regards
Shong
it works!!
thank you very much Shong