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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to convert String to date in talend

hi,
i have date which is in string "MM/dd/yyyy" and i want to convert same format in DATE data type in talend,
means
"MM/dd/yyyy" data type(String) ---> MM/dd/yyyy data type(DATE)
how could i do this please provide the solution.
thanks and regards
Shailendra Shukla

Labels (2)
67 Replies
Anonymous
Not applicable
Author

Hi any one can help me how to solve this issue...................

see i have a soure in excel like id name date
100 raj 17/10/2013
200 ram 15/09/2014
300 kumar 09/10/2013
400 ragu 08/11/2014 Now i want to load all the entire rows of data into a tmssloutput...........(Note: My OS System date format is MM/dd/yyyy")

if i extract the data form excel to tmssqloutput through tmap iam getting only the rows from excel, which is in the os date format like MM/dd/yyyy

My output is id name date
300 kumar 09/10/2013
400 ragu 08/11/2014 Because its considering in source MM/dd/yyyy format, so these rows 09, 08 are not bigger than 12 month. But remaining rows are bigger than 12 month .

But i entered the rows in the meaning of dd/MM/yyyy format in excel...................i used one function for this problem
(row1.date!=null)?TalendDate.parseDate("dd/MM/yyyy",row1.date):null ........ this function is only ok for tlog row as a output, but if used tmssqlout put its showing only the date between january 1,1753 and december 31 ,9999 are accepted.
Anonymous
Not applicable
Author

Hello
To convert a date format with a tMap you just have to change the format in the Date Pattern column

http://image.noelshack.com/fichiers/2014/10/1393852317-bk-talend-staging-map.png
Jr
Anonymous
Not applicable
Author

Hi any one can help me to solve this issue
I have a source in excel like id name date
10 Ravi 18/05/2014
20 Naraine 06/12/2013
30 Mahesh 23/10/2012
40 Ganesh 09/10/2010
Note :
Now i want to load the entire rows of data in to tmssqloutput, but iam getting only the rows which in MM/dd/ yyyy format in source.
Because its considering the source in MM/dd/yyyy format , so i got only the rows which is less than 12 month like 09/10/2010 and 06/12/2013.

But i entered the rows in excel in the meaning of dd/MM/yyyy............... if i used parsed date fuction in tmap i got all the rows. this is only ok for tlogrow but not for tmssqloutput.
if i used tmssqloutput i got this error...... only the date between january 1 1753 and december 31 9999 are accepted. Any solution for this..............
Anonymous
Not applicable
Author

Hi mahadevank,
Please stick to one topic https://community.talend.com/t5/Design-and-Development/How-to-convert-string-to-date-format/td-p/544... so that we can pay individual attention on your question.
Best regards
Sabrina
Anonymous
Not applicable
Author

Hi any one knows how to set max value(Date ) to context variable for each job run .................if yes than kindly provide me the solution
My source is excel and i created context variable with some date value to filter the data for incremental load logic for tmssqloutput
Anonymous
Not applicable
Author

Hi any one can help to solve this problem..................
Here i creating a mapping for incremental load logic.
Here i created one context variable with some initial value is called Contex.Last_Date= 01/01/2000
MY Problem is...................
1. For First time load i used insert option in tmssqloutput for full load , here i got full rows from source correctly .
2.But in second load again it reads all the rows from source and its not filter the rows greater than contex.Last_Date, because the value of context variable is not changed in tfilter .

Please any one knows the solution, than kindly help me to solve this.
0683p000009MAJk.jpg 0683p000009MALp.jpg 0683p000009MALu.jpg 0683p000009MALz.jpg
Anonymous
Not applicable
Author

Hi Mahadevank,
Where are you calculating the max date? Are you calculating it from the excel?
Why don't you calculate the max date from the target table, so that you can assign it to the context variable, before starting with the actual load. Then when you use it in your filter, you will get the correct results.
Anonymous
Not applicable
Author

Can you provide me one screenshot for incremental load logic................
Anonymous
Not applicable
Author

Hi,
Attaching the screenshot of the job. Here, the target table is first used as input, to get the max date in the target. Then the tjavarow (variable_assignment) component assigns the said max date to the context variable, last_date. After the successful assignment, we go on to our load, using excel as input, and filtering out rows as per the max date of the target table.
Hope this helps.
0683p000009MABH.jpg 0683p000009M9mT.jpg 0683p000009MA5U.jpg 0683p000009MAM4.jpg
Anonymous
Not applicable
Author

Hi thank you for your response .....................
From your screen shot i have to know few things.
1. where is the table name in your tmssqlinput and schema in edit schema option (table structure).
My error is .............
1. If i used the all the components and queries like you mentioned ur screen shot , i got MaxDate cannot be resolved or is not field error.
2. if i used the MaxDate as a column in tmsqlinput means , i got null pointer exception error.

how can i solve this ..................now