How to change code from tjava to globalmap.put variable

Six Stars

How to change code from tjava to globalmap.put variable

Hi,

i want to use the below java code into globalmap.put variable. so that i can use those values as parameters like  '" + ((String)globalMap.get("xxxx"))+"' 

below is the code .

Date lastDec =TalendDate.parseDate("yyyy-MM-dd", TalendDate.getDate("yyyy-MM-dd"));
System.out.println("param1: "+TalendDate.TO_CHAR(lastDec, "MMM-yy"));

 

Date prevYear1 = TalendDate.ADD_TO_DATE(lastDec, "YYYY", -1);
System.out.println("param3: "+TalendDate.TO_CHAR(prevYear1, "MMM-yy"));

 

Date prevYear = TalendDate.ADD_TO_DATE(lastDec, "MM", -3);
System.out.println("param2: "+TalendDate.TO_CHAR(prevYear, "MMM-yy"));

 

example i need like this.

 

globalMap.put("lastDec",
TalendDate.TO_CHAR(TalendDate.ADD_TO_DATE(
TalendDate.setDate(TalendDate.getCurrentDate(), 12, "MM"), "YYYY", -1), "MMM-yy"));

Forteen Stars TRF
Forteen Stars

Re: How to change code from tjava to globalmap.put variable

Here it is:

globalMap.put("lastDec", TalendDate.ADD_TO_DATE(TalendDate.setDate(TalendDate.getCurrentDate(), 12, "MM"), "YYYY", -1));
System.out.println("lastDec: "+TalendDate.TO_CHAR((Date)globalMap.get("lastDec"), "yyyyMM"));

globalMap.put("prevYear1", TalendDate.ADD_TO_DATE((Date)globalMap.get("lastDec"), "YYYY", -1));
System.out.println("prevYear1: "+TalendDate.TO_CHAR((Date)globalMap.get("prevYear1"), "MMM-yy"));

globalMap.put("prevYear", TalendDate.ADD_TO_DATE((Date)globalMap.get("lastDec"), "MM", -3));
System.out.println("prevYear: "+TalendDate.TO_CHAR((Date)globalMap.get("prevYear"), "MMM-yy"));

TRF