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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
JSlatorMHC
Contributor
Contributor

Using TalendDate.getDate and Parsing

Hi All,

I am using tMap to add a date column using TalendDate.getDate("DD-MM-CCYY"). This is so a can trend on certain data so need a date of data extract (History_Date) added to every row.

When I select the type as Date i get a error saying "Cant change string to date" so have to revert it back to string. I have looked through the expressions and it looks like a now need to use ParseDate.

Can i do this in the same tMap? and how or do i need to do it some other way

The column i have added can be seen at the bottom of the list on the right hand pain

0695b00000H99ihAAB.png

Thanks

Labels (2)
3 Replies
gjeremy1617088143

Hi @John Slator​,

https://help.talend.com/r/QrWkwPvKmKybs~JNLeBt3Q/HUMgeiW9TakG3aDk5I0Hjw

TalendDate.getDate("Format of the string - ex: CCYY-MM-DD") return a date

TalendDate.formatDate("date format - eg.: yyyy-MM-dd HH:mm:ss", Date() to be formatted) return a String from a date

TalendDate.parseDate("format date of the string to be parsed", "string in the format of the date to be parsed") return a date from a String

Send me Love and Kudos

 

 

JSlatorMHC
Contributor
Contributor
Author

Thanks @guenneguez jeremy​ 

 

i now understand the parsedate....so in my case if i am using TalendDate.getDate on a column i have added to the ouput of the tMap where abouts do you parse it?

 

Thanks

gjeremy1617088143

for example if i want a new field on my output with the today date :

 

for a date output

in the value field of the output :

TalendDate.getDate("YYYY-MM-dd")

in the schema of the output : select Date as type and "YYYY-MM-dd" as date pattern.

 

for a String output

in the value field of the output :

TalendDate.formatDate("YYYY-MM-dd",TalendDate.getDate("YYYY-MM-dd"))

in the schema of the output : select String as type

 

Here "YYYY-MM-dd" is the pattern I want for the date :

result for today : 2021-07-28