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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Extract year & Month from Date

Hi all,
I have a problem.. I want to extract Year and month from date. I tried with this method :
row1.var.getYear()
row1.var.getMonth()
But it doesn't work
For exemple, my date is "2006-01-01" , with tLogRow, when i do
getMonth() i found in the output "0"
for "2006-02-01" i found "1"
for "2006-03-01" i found 2
getYear() ---> i found 106 in the output
getDay()---> i found 0

Why this method doesn't work ? Is there an other method for extraction ?
Thanks in advance,

Rajaa
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi Raja,

Use below Methods:
Extract Year-->> TalendDate.formatDate("yyyy",row1.Date)
Extract Month-->> TalendDate.formatDate("MM",row1.Date)
I hope Above logics are work fine..
Thanks,
kumar

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Hi Raja,

Use below Methods:
Extract Year-->> TalendDate.formatDate("yyyy",row1.Date)
Extract Month-->> TalendDate.formatDate("MM",row1.Date)
I hope Above logics are work fine..
Thanks,
kumar
Anonymous
Not applicable
Author

Hi Kumar,
Thank you so much for the help, it works 0683p000009MACn.png