AnsweredAssumed Answered

EPOCH DATE TIME

Question asked by srishti.jaiswal786863 on May 19, 2017
Latest reply on May 24, 2017 by kke@netcompany.com

Hi All, 

 

We are Converting a Datetime to Epoch Format as Required by Groovy Script: 

 

 

The Output is Coming as [Function Execution: Scripting-  Output[14:UserSmokerDeclarationDateEpoch, \/Date(1494358439000+0000)\/] from Map Function. 

 

The output of map function is mapped to a JSON Profile. Having this Field as Character. After Mapping a Wierd Characters are added   . 

 

"PersonVerifiedDate": "\\/Date(1494358439000+0000)\\/"

 

Groovy Script : 

 

 

import java.text.*;
import java.util.*;

def date = UserSmokerDeclarationDate
Date d1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(date);
UserSmokerDeclarationDateEpoch= d1.getTime();
UserSmokerDeclarationDateEpoch= '\\'+'/Date(' + UserSmokerDeclarationDateEpoch+ '+0000)'+'\\' +'/';

 

 

Outcomes