Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have this field in my xml input <IssueDate>2018-02-08 "T" 14:22:25</IssueDate>. I want to insert to mssql database with datetime format (i.e 2018-02-08 14:22:25.0000000). How can i parseDate in talend? in what string format? TalendDate.parseDate("yyyy-MM-dd 'T' HH:mm:ss", [row1.PurchaseOrdersFeed:/PurchaseOrdersFeed/PurchaseOrders/PurchaseOrder/Header/IssueDate]) => this is not working
I remove "T" from String. And it works now.
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss", StringHandling.EREPLACE([row1.PurchaseOrdersFeed:/PurchaseOrdersFeed/PurchaseOrders/PurchaseOrder/Header/IssueDate]," \"T\"","") )
Hi @JaRoi ,
Please find the code snippet for your requirement in tJava.
Date d1 = TalendDate.parseDate("yyyy-MM-dd 'T' HH:mm:ss", "2018-02-08 T 14:22:25");
System.out.println("Formatted Date : "+TalendDate.formatDate("yyyy-MM-dd HH:mm:ss.SSSSSS", d1));
Thanks and Regards,
Subhadip
I used xml map. I got error "The method parseDate(String, String) in the type TalendDate is not applicable for the arguments (String, Date)" in code.
outOrderTable_tmp.OrderDate = TalendDate
.parseDate(
"yyyy-MM-dd 'T' HH:mm:ss",
treeNodeAPI_tXMLMap_1_TXMLMAP_OUT
.get_Date(
"row1.PurchaseOrdersFeed:/PurchaseOrdersFeed/PurchaseOrders/PurchaseOrder/Header/IssueDate",
"dd-MM-yyyy"));
;
I remove "T" from String. And it works now.
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss", StringHandling.EREPLACE([row1.PurchaseOrdersFeed:/PurchaseOrdersFeed/PurchaseOrders/PurchaseOrder/Header/IssueDate]," \"T\"","") )