Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 joe86
		
			joe86
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi All,
I need to convert a DATE to STRING with a condition.
I need to check if the incoming date (date with timestamp) is lesser than (current date + 7) days. If yes, then i need to pass a string like "To Be Expired" Else, I need to retain the incoming date (date with timestamp) value as it is. My incoming date column is of DateType DATE.
Can someone please help me to achieve this in tMap??
 joe86
		
			joe86
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 manodwhb
		
			manodwhb
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		@joe86,first you convert Organiser.CRBExpiryDate ting to date below way .
Organiser.CRBExpiryDate==null ?null :TalendDate.parseDate("dd/MM/yyyy HH:mm:ss", Organiser.CRBExpiryDate)
the second part use the one which worked for u in last time.
 joe86
		
			joe86
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		below worked for me. now the result is as expected for me 
(String) (Organiser.CRBExpiryDate == null ? Organiser.CRBExpiryDate : TalendDate.compareDate((TalendDate.addDate(TalendDate.getCurrentDate(),7,"dd")) ,Organiser.CRBExpiryDate)==1 ? "To Be Expired" :TalendDate.formatDate("dd/MM/yyyy", Organiser.CRBExpiryDate))
thanks a lot for all ur support 
 joe86
		
			joe86
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 manodwhb
		
			manodwhb
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		@joe86,good,please accept the solution
