Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Datetime parsing

Hi 

 

I am getting errors when I am trying to map a string field containing datetime data(from csv) from source to the final table using tmap.

 

I attach the screen shots below of the same.

 

I am using talend.dateparse function for getting the desired result but its showing unparseable date. The time stamp is not getting parsed and is throwing runtime error.   

 

 

Please help resolve this issue.0683p000009M9KD.png0683p000009M6pH.png

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi
I just made a testing: read the sample file using tFileInputDelimited, convert the string to a Date using expression
TalendDate.parseDate("dd/MM/yyyy HH:mm:ss",row2.Swipe_In_Time)
tFileInputDelimited--main--tMap--tLogRow

The job runs fine.

Regards
Shong

View solution in original post

10 Replies
billimmer
Creator III
Creator III

Here is an example of converting a string to a date

 

TalendDate.formatDate("yyyy-MM-dd",TalendDate.parseDate("yyyyMMdd",row1.Created_Date))

 

The string in the example is row1.Created_Date.  Modify the example with your formatting.

 

 

Anonymous
Not applicable
Author

Hi Billimmer

I need to convert from string to datetime format (i.e yyyy-mm-dd hh:mm:ss
format ) to the target table in mysql database.

It would be great if you could help me in this regard.

Thanks & Regards
Tryambak De
Anonymous
Not applicable
Author

Hi
Change the expression to:
TalendDate.parseDate("dd/MM/yyyy HH:mm:ss")

//HH: hours in day (00-23), hh: 12 hours AM or PM (00-12)

Regards
Shong
Anonymous
Not applicable
Author

Hi Shong

I did this but its giving me unparasable error for the time part.

Thanks & Regards
Tryambak De
manodwhb
Champion II
Champion II

Can you share some sample data for that field which you were trying to convert string to date.
Anonymous
Not applicable
Author

Hi Manodwhb

Please find attached the sample data set.

Thanks & Regards
Tryambak De
manodwhb
Champion II
Champion II

I am not able to find sample data set.
Anonymous
Not applicable
Author

Hi Please find the sample data set attached.


Attendance_Dtls.csv
manodwhb
Champion II
Champion II

Open the csv file in some editor like notepad++ and check the date format for that column and specify that format in the above @shong expression.