Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Convert Date format from YYYY/MM/DD to MMM/DD

HI,

 

I am trying to convert a date format from yyyy/mm/dd to MMM-YY. E.g., if the date in the input excel is 2019/01/01 then I want the output as JAN-19 and I have used TalendDate.formatDate("MMM-yy",row28.Start_Date) in the Variable and StringHandling.UPCASE(Var.var1) in the expression . 

 

The input file is excel and the Type is Date "YYYY/mm/DD". For the output format I am changing it to String in variable and string in output excel. I am getting null pointer exceptions about Dateformat so I tried to add row28.Start_Date==null?null:TalendDate.formatDate("MMM-yy",row28.Start_Date) .

It is running without errors but now it is returning only blank for that oarticular column.

 

any help will be greatly appreciated.. Thanks

SK

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

 

You were right.. My bad. The input file value was actually blank for the record I was checking. I passed a dummy date and it processed fine. Thank you.. 

View solution in original post

5 Replies
akumar2301
Specialist II
Specialist II

Ideally while reading excel , in tFileInputExcel schema you could define yourcolumn as Date and change the date pattern to MMM-yy . It should work.
Anonymous
Not applicable
Author

Hi akumar2305,

 

Thanks for the reply.

I would be using that column to map other columns in the output so I dont think I can change the dateformat because it will affect other column data.

vapukov
Master II
Master II

possible it some mistake somewhere, because it work as expected:

 

[statistics] connecting to socket on port 3784
[statistics] connected
.----------.
|tLogRow_1 |
|=--------=|
|Start_Date|
|=--------=|
|Jan-19    |
|null      |
'----------'

[statistics] disconnected
akumar2301
Specialist II
Specialist II

Try to put tLogRow and check if you are able to read start_date correctly.

I think it is coming as NULL or "" to your expression.

Please share you input sample and design . It must be very small issue.
Anonymous
Not applicable
Author

Hi,

 

You were right.. My bad. The input file value was actually blank for the record I was checking. I passed a dummy date and it processed fine. Thank you..