Hitachi Content Platform​

 HCI date conversation Stage

  • Object Storage
  • Hitachi Content Intelligence HCI
Hitendra Talluri's profile image
Hitendra Talluri posted 04-16-2020 11:40

@Jared Cohen​ @Jonathan Chinitz​ @Donald Pannese​ 

 

i have a requirement to convert a date filed with the below input format.

 

Source Date:2019-10-01T16:06:27.5859855+02:00

 

i need to convert the above date to ISO string and drop the millseconds

 

Regex:(^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})\.\d{7}([\+\-]\d{2}:\d{2})

 

I used capturing groups to match all the above date and how do i select the values only from the capturing groups so that the output field show the below date format.

 

yyyy-mm-dd'T'HH:mm:ss'Z'

 

 

 


#HitachiContentIntelligenceHCI
Jonathan Chinitz's profile image
Jonathan Chinitz

I believe if you use a Date Conversion stage with the following pattern/replacement string:

2020-04-16_0848

you will get the desired result:

2020-04-16_0854

Let me know if this works for you.

 

 

Jonathan Chinitz's profile image
Jonathan Chinitz

This was the wrong answer

Jonathan Chinitz's profile image
Jonathan Chinitz

This is the right one. I am attaching a pipeline snippet that does the following:

  • Field Parser -- splits out the timestamp on the '.' into 2 fields
  • Replace -- removes the milliseconds from the second field
  • Append -- the second field back to the first field
  • Date Conversion -- runs the new field thru date conversion

You could probably do this much quicker with a Javascript stage :-)

Hitendra Talluri's profile image
Hitendra Talluri

Thanks Jon. I was doing the same ,but want to know if there is a way we can select the capturing group in regex and map it to date value in this stage.

Jonathan Chinitz's profile image
Jonathan Chinitz

I don't believe that is possible. I'll ask ENG and see what they say.