Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
INESBK
Creator

Problem with format date and time in Metadata Excel File

Hi,

 

I would like to read data from an excel file. Amongst the columns of this file, there are Date and Time columns that are filled using expression in the excel file.
Using talend and when I add a metadata File I get a preview at the beginning of these expressions as shown in Figure 1. And then a weird preview of the data formats in the Date and Time column as show in Figure2. 

How can I solve this problem especially that I need the date column format  be "dd/MM/yyyy" and the time column be "HH:mm:ss" ?

 

Thanks in advance for your help.

 

0683p000009M1n7.png0683p000009M1gM.png

 

 

 

Labels (2)
1 Solution

Accepted Solutions
INESBK
Creator
Author

Hi,

 

I solved the problem using a routine to convert the date with code.

here is the solution : 

SimpleDateFormat sdf=new  SimpleDateFormat ("EEE MMM dd HH:mm:ss Z yyyy", Locale.ENGLISH);

return sdf.parse(d);

View solution in original post

10 Replies
Anonymous
Not applicable

Hi,

 

   Could you please share the job screenshots and the component details to the post?

 

Warm Regards,
Nikhil Thampi

Please appreciate our members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

INESBK
Creator
Author

Here are screenshots of my job.

 

0683p000009M1nC.png0683p000009M1nH.png


3.PNG
4.PNG
Anonymous
Not applicable

Hi,

 

    The data will be picked based on the base format for the excel column. Since the base format of the column is in different format (for example like below), you will have to first parse the date in that format and then convert it later to the format of your choice.

 

Mon Jan 01 09:10:13 IST 2018

 

    I would suggest to first parse the data as-is using a String variable and do a data type conversion within Talend using tConvertType component.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

 

INESBK
Creator
Author

Hi,

 

Thanks for your replay.

 I used the tConvertType component to convert an input string to date ("EEE MMM dd HH:mm:ss zzzz yyyy") as shown in figure 1. 

0683p000009M1nv.png

 

Than i used tmap compnent to convert this format in simple format (yyyy-MM-dd) as show in figure 2.

 

But Nothing is displayed and no error as is shown in figure 3.

 

0683p000009M1o5.png

Anonymous
Not applicable

Hi,

 

    Could you please print the output immediately after reading from excel sheet and verify the results?

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

INESBK
Creator
Author

Hi,

 

Here is an example of the output of the excel file.

 

0683p000009M1oA.png
I would like to change the format of the input date into "yyyy-MM-dd"
I would like to change the format of the input time into "HH:mm:ss"
Already if you have noticed the format of the time (column 2) is strange and I would like to take from this format just the time. 

 

Best regards,

Anonymous
Not applicable

Hi,

 

Could you please add tLogrow here and print the results for verification. Once you identify the stage correctly, we can check the next steps from that point.

0683p000009M1UB.png

 

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

INESBK
Creator
Author

Hi,

 

Here is the result of the job.

 

0683p000009M1WA.png

 

The first line is the date and time in string format (on the same format as they were read in the metadata repositry). The empty second and third lines correspond to the t_logrow4 and tlogrow1 .

 

Best regards,

Anonymous
Not applicable

Thanks for the details.

 

The expressions in the excel sheet seems to create issues and it is not able to identify the time part of the data.

 

I am not fully sure about it but let's check with @xdshi for her advice.

 

Warm Regards,

 

Nikhil Thampi