Convert Unix Timestamp

More advanced topics discussed.

Moderators: Susan Smith, admin, Gabriel

Post Reply
bluesfannoz
Posts: 291
Joined: Fri Jun 19, 2009 9:01 am
Location: Lawrence, Kansas
Contact:

Convert Unix Timestamp

Post by bluesfannoz »

Anyone know a way in BR to convert a Unix Timestamp to work with BR?

Example of a Unix Timestamp 1660657729

Equivalent Date Time:
August 16, 2022 8:48:49 AM
Steve Koger
Computer Specialist
SEKESC-MACS Division
GomezL
Posts: 258
Joined: Wed Apr 29, 2009 5:51 am
Contact:

Re: Convert Unix Timestamp

Post by GomezL »

See: https://www.unixtimestamp.com/
Seconds Since Jan 1/1970

Also, TIMER is BR is the same value:


Human Readable Time Seconds
1 Hour 3600 Seconds
1 Day 86400 Seconds
1 Week 604800 Seconds
1 Month (30.44 days) 2629743 Seconds
1 Year (365.24 days) 31556926 Seconds

I didn't do the math, but you should be able to compare the value to Timer (NOW) and then do date math.
GomezL
Posts: 258
Joined: Wed Apr 29, 2009 5:51 am
Contact:

Re: Convert Unix Timestamp

Post by GomezL »

David provided the magic formula!

pr date$(days(19700101)+timer/86400,'M/D/CY') = 8/16/2022
bluesfannoz
Posts: 291
Joined: Fri Jun 19, 2009 9:01 am
Location: Lawrence, Kansas
Contact:

Re: Convert Unix Timestamp

Post by bluesfannoz »

Thanks! David and Luis Exactly what I needed!
Steve Koger
Computer Specialist
SEKESC-MACS Division
bluesfannoz
Posts: 291
Joined: Fri Jun 19, 2009 9:01 am
Location: Lawrence, Kansas
Contact:

Re: Convert Unix Timestamp

Post by bluesfannoz »

In actuality Luis, Timer is what I needed because I am trying to determine how long ago I authorized a user and the api returns a unix timestamp. So I can just subtract that timestamp from Timer and know how many seconds it has been! Perfect!

Thanks again both David for your correct calculation and Luis for pointing out the Timer function!
Steve Koger
Computer Specialist
SEKESC-MACS Division
Post Reply