unix converter

dualznz

Member
Licensed User
Longtime User
Hi all
this is for a widget that im building for my application
the time is used to show when the next update will be performed.

say now + 45 minutes

i have tried the following to convert unix to standard datetime format but still shows unix output

B4X:
Dim TicksDiff, HoursDiff, unixtimestamp As String

unixtimestamp = DateTime.Now * DateTime.TicksPerMinute
TicksDiff = DateTime.Now - unixtimestamp * 1000
HoursDiff = TicksDiff / DateTime.TicksPerHour

i am trying to do something like this

B4X:
dim newdate as string

newdate = datetime.now + 45 * datetime.ticksperminute

// display as standard formate or DD/MM/YY HH:MM or just HH:MM

any help would be greateful
 

dualznz

Member
Licensed User
Longtime User
nevermind i found a simple solution to do this

B4X:
DateTime.DateFormat = "hh:mm"
   Dim dt As String = DateTime.Date(DateTime.Now + 45 * DateTime.TicksPerMinute)
   label1.Text = dt
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…