798
Views
5
Comments
Solved
Convert Date time to Timestamp
Question
Application Type
Reactive
Service Studio Version
11.14.12 (Build 59645)

Hello,

  I am working on Calendar application, and I have the following code to convert Date time to Timestamp: 

DiffSeconds(TextToDateTime("1970-01-01"),InputDateTime)

The function DiffSeconds will work only for dates up to 2037 . Is there any way to convert to Timestamp using another function / logic ?
Are there any plans to upgrade the method to Long Integer or decimal?

2019-07-01 07-16-04
Vinod Patidar
Solution

Hi Savvas,

I have cross check DiffSeconds functions at my end and it is working properly. I have used below two dates -

DiffSeconds(TextToDateTime("1970-01-01"),TextToDateTime("5047-01-01"))

I am getting below result from above code - 97100726400 

Also validated results as below -

Thanks

Vinod

UserImage.jpg
Savvas Savva

Thanks for your reply! Nice, the method is not  limited with int 32.  I change my function output parameter to decimal and everything working as expected!

UserImage.jpg
Savvas Savva

If you know , the unexpected values comes only when using integer variable ? 

2021-12-30 19-28-37
Alain Chautard

On a similar note, I created this simplified expression that returns the current UNIX timestamp:

DiffSeconds(#1970-01-01#,CurrDateTime())
2023-08-28 07-00-10
Paulo Torres
Champion

Or Javascript: today.getTime()

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.