Four Stars

[resolved] Any way to specify this datetime format from schema editor ??

This is what kind of datetime format I have inside xml file:
12/3/2010 4:02:24 PM
Do I need to import this field as a string and then extract the date, or can I just specify a datetime format inside the schema editor in tFileInputXML ??
From the drop down menu (CTRL+SPACE) in date pattern column of schema editor I don't see the possibility to specify this type of format. The trouble is that days, months and hours can be either one or two numbers (no leading zeros).
Thx.
1 ACCEPTED SOLUTION

Accepted Solutions
Seven Stars

Re: [resolved] Any way to specify this datetime format from schema editor ??

The drop-down options for date pattern in the schema editor are just common suggestions. You can type any pattern you want built from the different date-part symbols or even use a variable.
4 REPLIES
Community Manager

Re: [resolved] Any way to specify this datetime format from schema editor ??

Hi
Specify the datetime format inside the schema in tFileInputXML as:
"dd/MM/yyyy hh:mm:ss aa"
or
Extract it as a string and then convert this string to Date on tMap or other component, for example:
TalendDate.parseDateLocale("dd/MM/yyyy hh:mm:ss aa", yourInputColumn,"en")
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Seven Stars

Re: [resolved] Any way to specify this datetime format from schema editor ??

The drop-down options for date pattern in the schema editor are just common suggestions. You can type any pattern you want built from the different date-part symbols or even use a variable.
Four Stars

Re: [resolved] Any way to specify this datetime format from schema editor ??

It works. Thanx guys.
One Star

Re: [resolved] Any way to specify this datetime format from schema editor ??

Hi,
I specified the datetime format inside the schema of tFileInputdelimited as:
"MM/dd/yyyy HH:mm:ss aa" so that I can load the data "5/17/2016 12:00:00 AM" into DB2. 
But I couldn't load the exact format. 
I come across "Unparseable date" error and the date loaded into the db is "5/17/2016 12:00:00"
Can you please help to load this date format into DB2. 
Thanks in advance. Smiley Happy