P potman100 Active Member Licensed User Longtime User Jun 20, 2012 #1 Hi Can anybody shed any light on how I would do this in b4a. I have a timestamp (Seconds since 1/1/70) and I want to convert it to date & time i.e The Timestamp 1339830670 converts to 16/06/2012 07:11:10 and then find the difference in hours from the date and time now. Thanks in advance for any help. Regards Potman
Hi Can anybody shed any light on how I would do this in b4a. I have a timestamp (Seconds since 1/1/70) and I want to convert it to date & time i.e The Timestamp 1339830670 converts to 16/06/2012 07:11:10 and then find the difference in hours from the date and time now. Thanks in advance for any help. Regards Potman
corwin42 Expert Licensed User Longtime User Jun 20, 2012 #2 To convert from a normal unix timestamp to B4A Ticks value you just have to multiply it with 1000. So to get the difference in hours to the current time you can write something like this: B4X: TicksDiff = DateTime.Now - unixtimestamp * 1000 HoursDiff = TicksDiff / DateTime.TicksPerHour Upvote 0
To convert from a normal unix timestamp to B4A Ticks value you just have to multiply it with 1000. So to get the difference in hours to the current time you can write something like this: B4X: TicksDiff = DateTime.Now - unixtimestamp * 1000 HoursDiff = TicksDiff / DateTime.TicksPerHour
P potman100 Active Member Licensed User Longtime User Jun 21, 2012 #3 Hi corwin42 Works a treat. Thanks for the help Regards Potman Upvote 0