Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
joe86
Contributor
Contributor

Convert DATE (date and time) to STRING (date and time)

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??

Labels (2)
24 Replies
joe86
Contributor
Contributor
Author

i tried this way also, still it threw error. Then only i noticed that the data type of "Organiser.CRBExpiryDate" is "String". So only i gave that formateDate..
manodwhb
Champion II
Champion II

@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
Contributor
Contributor
Author

@manodwhb

below worked for me. now the result is as expected for me 0683p000009MACn.png

(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 0683p000009MACn.png

joe86
Contributor
Contributor
Author

tried this also and still it failed with the previous error (the screenshot attached before). anyways, adding "(string)" worked..
manodwhb
Champion II
Champion II

@joe86,good,please accept the solution0683p000009MACn.png0683p000009MACn.png0683p000009MACn.png