cancel
Showing results for 
Search instead for 
Did you mean: 

Importing date attribute into Hybris commerce through Data hub

0 Kudos

Hi Experts,

I am trying to import date attribute to Hybris commerce through Data hub but getting following error:

de.hybris.platform.jalo.JaloInvalidParameterException: cannot parse date '4/8/1996' with specified pattern 'MMM d, yyyy h:mm:ss a' due to Unparseable date: "4/8/1996"

canonical extension code is as follows:

             <attribute>
                 <name>START_DATE</name>
                 <model>
                     <localizable>false</localizable>
                     <collection>false</collection>
                     <type>Date</type>
                     <primaryKey>false</primaryKey>
                 </model>
             </attribute>

In Hybris start date is declared as java.util.Date and I am importing csv file into Data Hub where START_DATE value is 4/8/1996.

The problem is, I cannot set date in 'MMM d, yyyy h:mm:ss a' format as this format contains comma and in csv comma is delimiter. Can someone point out where I need to do changes to parse the date?

Accepted Solutions (1)

Accepted Solutions (1)

Slava
Advisor
Advisor
0 Kudos

Kaushik,

First, if I'm not mistaken, commas can be escaped in a CSV file by wrapping the text in "", e.g. 123, "a field with ,"

Second, based on the exception it seems like the problem is not when you're importing data into DataHub but rather when DataHub publishes data to the ECP. The reason I think so is the exception you gave in your question - DataHub does not use de.hybris.platform... classes. If so, then you possibly can specify format of the data using the export expression in the target model. Based on this document: https://help.hybris.com/6.7.0/hcd/1c8f5bebdc6e434782ff0cfdb0ca1847.html#loio1c8f5bebdc6e434782ff0cfd... you can specify [dateformat=MM/dd/yyyy] attribute modifier in the export expression.

Answers (0)