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: 
Anonymous
Not applicable

String to date conversion

My input from database is having "date" in string datatype with size 50, which is sending date in yyyy-mm-dd format. I want to store it at the destination in String(50) with mm-dd-yyyy format. Solution please.

Labels (2)
13 Replies
Anonymous
Not applicable
Author

i shoudn't drop records, because after this transmission those blank date fields will be having a data thru front end. I need to pass these blanks. Hence i did like below in tMap but it didnt work. Please suggest.

 

row2.DiagnosisActivityStartDate == "" ? "" :  TalendDate.formatDate("MM-dd-yyyy",TalendDate.parseDate("yyyy-MM-dd",row2.DiagnosisActivityStartDate)) 

TRF
Champion II
Champion II

"".equals(row2.DiagnosisActivityStartDate) || 
row2.DiagnosisActivityStartDate == null ? "" : TalendDate.formatDate("MM-dd-yyyy",TalendDate.parseDate("yyyy-MM-dd",row2.DiagnosisActivityStartDate))
Anonymous
Not applicable
Author

Wow TRF... it worked.. Thanks again

Anonymous
Not applicable
Author

Hello TRF,

 

Can you please explain the statement you have given for the solution? 

 

"".equals(row2.DiagnosisActivityStartDate) || 
row2.DiagnosisActivityStartDate == null ? "" : TalendDate.formatDate("MM-dd-yyyy",TalendDate.parseDate("yyyy-MM-dd",row2.DiagnosisActivityStartDate))

It worked actually, but the output excel's cell is in "General" format and i am expecting in "Custom" format cell with MM-DD-YYYY option (just like the attached image) then only the formula will pick this cell for calculation. Please guide


Graph9.jpg