Epoh unix time conversion

Hi

Do Novacura have any inbuilt function to convert from/to Epoch unix time? that start 1970-01-01 00:00:00
If not, anyone have a code that they could share?

  • List item

Karl

Hi

I am trying to do this, with below code, but getting second and comma. how do i remove the comma? And why is there milliseconds?
Have tried both with date() and now()

// for all time
let epochUnix = DateTime.CreateDateAndTime(1970, 01, 01, 01, 01, 01);
let epochUnixnow = date(Now());
return DateTime.DifferenceInSeconds(epochUnix,epochUnixnow );// + expirevalue;

Hi,

I think the CreateDateAndTime needs is milliseconds. But maybe something like this to round it off:

Let start = DateTime.CreateDateAndTime(1970, 01, 01, 01, 01, 01);
Return round(DateTime.DifferenceInSeconds(now(),start)) ;

Epoch is usually displayed in milliseconds since 1970 though, so be aware that you are now counting seconds instead.