One Star

date format in talend

Please let me know how to i make talend understand the date format of "2/21/2005 12:09:18 PM".
It says that it is unable to parse the date.

13 REPLIES
One Star

Re: date format in talend

What are you telling that date to?

for date format codes: http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html
One Star

Re: date format in talend

I am trying to convert the date format by using the function TalendDate.parseDate("MM/dd/yyyy hh:mm:ss",row1.START_DAY_ID ) in tmap.
But still it throughs the error Unparseable date: "2/21/2005 12:09:18 PM"
One Star

Re: date format in talend

1. is "2/21/2005 12:09:18 PM" coming in as a date or string value? (what type is row1.START_DAY_ID?)
2. "MM/dd/yyyy hh:mm:ss" should actually be "M/dd/yyyy hh:mm:ss" (only need 1 M and had 2 spaces between yyyy and hh)
One Star

Re: date format in talend

The data type of row1.START_DAY_ID is string.
I have reduced the extra space between yyyy and hh.
I get the error below when i use the function as TalendDate.parseDate("M/dd/yyyy hh:mm:ss",row1.START_DAY_ID )
Exception in component tDBOutput_1
java.sql.SQLException: Optional feature not implemented
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterString(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setChar(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setString(Unknown Source)
One Star

Re: date format in talend

interesting... that error I have no idea about.
One Star

Re: date format in talend

Hello,
I have a question,
Right now, I have to check whether the input string is in the format of "YYYYMMWW",(year month week)
so how can I parse this into another string?
is Talend.parseDate() helpful? if so how can I use this?
I've tried Talend.parseDate("yyyymmww",row1.weekstring).toString(), but it is not writing into the table as desired.
It has gone into the table in such format (Sun Apr 18 00:04:00 SGT 2010).
Please guide me how can I do.
Thanks.
Community Manager

Re: date format in talend

Hello,
I have a question,
Right now, I have to check whether the input string is in the format of "YYYYMMWW",(year month week)
so how can I parse this into another string?
is Talend.parseDate() helpful? if so how can I use this?
I've tried Talend.parseDate("yyyymmww",row1.weekstring).toString(), but it is not writing into the table as desired.
It has gone into the table in such format (Sun Apr 18 00:04:00 SGT 2010).
Please guide me how can I do.
Thanks.

Hi
I have replied you on 16769. I think you should use the built-in function TalendDate.isDate(String stringDate, String pattern).
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: date format in talend

Hi Shong,
Sorry my bad, I have left to write the main part,
I have to check the date format and compare it to the current date. Smiley Happy
Community Manager

Re: date format in talend

Hi Shong,
Sorry my bad, I have left to write the main part,
I have to check the date format and compare it to the current date. Smiley Happy

Ok, let's discuss your problem in your 16769.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: date format in talend

svp comment generer des tables destinataires automatiquement depuis un traitement de la table source? merci d'avance Smiley Happy
Moderator

Re: date format in talend

Hi raouf12,
This is an international forum and English is the language we use. Posting in English will allow you to get more visibility and more help. Thanks for your understanding!
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: date format in talend

Hello, How can I convert month name to number in talend. for example to January to 1, February to 2, March to 3 and so on.
Moderator

Re: date format in talend

Hi avvirama,
Is your input month name source  "Date" data type?
If so, please try to use the below expression in tMap
TalendDate.formatDate("yyyy-MM-dd",your date field);
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.