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

Six Stars

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


Accepted Solutions
Six Stars

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

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.. 


All Replies
Eleven Stars

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

Ideally while reading excel , in tFileInputExcel schema you could define yourcolumn as Date and change the date pattern to MMM-yy . It should work.
Regards
Abhishek KUMAR
Six Stars

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

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.

Forteen Stars

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

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
-----------
Eleven Stars

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

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.
Regards
Abhishek KUMAR
Six Stars

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

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.. 

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog