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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

convert string month in date to integer month in talend ("01-jan-2012", "01-01-2012") Urgent help plzz

Hi,

HOw can i convert string month in date to integer month in Talend using TMap or anything.  Need urgent help

for eg "01-jan-2012" to  "01-01-2012"

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi @Chirgal

 

I did this my writing simple code in tjavarow component.

 

//Code generated according to input schema and output schema
output_row.Date = input_row.Date;
//output_row.newdate = input_row.Date;
 
//Code generated according to input schema and output schema
String sample_date = input_row.Date;
//String newdate=null;
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yy");
Date date = sdf.parse(sample_date);
sdf.applyPattern("dd-MM-yyyy");
output_row.newdate = sdf.format(date);

View solution in original post

4 Replies
Anonymous
Not applicable
Author

TalendDate.formatDate(TalendDate.parseDate("01-Jan-2012", "dd-MMM-yyyy"),"dd-MM-yyyy")
Anonymous
Not applicable
Author

@Chirgal,

 It not happening and throwing jVM errors. Please find the screenshot and attached source file0683p000009LrlF.png0683p000009LrlK.png0683p000009Lrc9.png


date_sample.csv
Anonymous
Not applicable
Author

My fault try:
TalendDate.formatDate("dd-MM-yyyy",TalendDate.parseDate(row1.Date, "dd-MMM-yyyy"))
Anonymous
Not applicable
Author

Hi @Chirgal

 

I did this my writing simple code in tjavarow component.

 

//Code generated according to input schema and output schema
output_row.Date = input_row.Date;
//output_row.newdate = input_row.Date;
 
//Code generated according to input schema and output schema
String sample_date = input_row.Date;
//String newdate=null;
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yy");
Date date = sdf.parse(sample_date);
sdf.applyPattern("dd-MM-yyyy");
output_row.newdate = sdf.format(date);