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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Get yesterday's date and convert it to a string in yyyy-MM-dd format?

Hi, I would like to get yesterday's date and convert it to a string in the format 'yyyy-mm-dd'
Here is what I have tried in a tJavaRow component:
outputFile.row = StringHandling.EREPLACE(tJava.row,"d",TalendDate.addDate(TalendDate.getCurrentDate(),-1,"dd").toString());

This is working but gives an unformatted date
I have looked at the tJava component but don't understand how it is meant to work
See my job design attached
Thank You 0683p000009MACn.png
Labels (3)
2 Replies
Anonymous
Not applicable
Author

I would not do this in a tJavaRow. Use a tMap and set for the column you want this expression:
TalendDate.formatDate("yyyy-MM-dd", TalendDate.addDate(TalendDate.getCurrentDate(), -1, "dd"))
Anonymous
Not applicable
Author

Hi, thank You this code worked 0683p000009MACn.png