Skip to main content
Question

Epoch Seconds Conversion in AA

  • February 13, 2023
  • 6 replies
  • 237 views

Forum|alt.badge.img+6

Hi Developers,

I am trying to convert a specific date into epoch seconds in AA. However, that option is not available in the Datetime Action. Is there any alternate or shortcut way we can achieve this? 
 

Forum|alt.badge.img

Hello @Kayal 2500 
Please provide an example of your problem, that is what will be the initial value and what is the target value you want to achieve?

Thanks!!


Forum|alt.badge.img+6
  • Navigator | Tier 3
  • February 13, 2023

Hi @shibashis001 

 

The date will be in this format : 13 Feb 2023 14:05:16

And the output should be like this in epoch seconds conversion : 1676297116


Forum|alt.badge.img+1
  • Cadet | Tier 2
  • February 13, 2023

Use the below JavaScript to get the epoch time. You need to replace the below date with your required date.

 

function ConvertToEpoch()
{
return Math.floor(new Date('12/2/2022').getTime()/1000.0)
}


Forum|alt.badge.img+19

Hi @Kayal 2500

There is no Inhouse package as of now, same can be achieved using any scripting languages like python or c#. Checkout below code in python

import time

date_str = "13 Feb 2023 14:05:16"
pattern = "%d %b %Y %H:%M:%S"
epoch_time = int(time.mktime(time.strptime(date_str, pattern)))
print(epoch_time)
 


Raul Jaimes
Forum|alt.badge.img+9
  • Navigator | Tier 3
  • February 13, 2023

@Kayal 2500

An approach additional to above is using an online converter like :

https://www.freeformatter.com/epoch-timestamp-to-date-converter.html

HTH

Regards


Forum|alt.badge.img+4

Here’s the best approach to convert epoch to date time variable.

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings