Android Question How to get tick of future time?

Reminisce

Active Member
Hello, I need to get the tick of 7 days to the future to enable make a calculation.
I have this UNIX value [1601132322] from my DB. I can convert it to ticks, but I need to get the ticks of 7 days from now.

how do i go about it?
 

Alex_197

Well-Known Member
Licensed User
Longtime User
Hello, I need to get the tick of 7 days to the future to enable make a calculation.
I have this UNIX value [1601132322] from my DB. I can convert it to ticks, but I need to get the ticks of 7 days from now.

how do i go about it?
B4X:
Dim P as Period
Dim D as int
Dim NewDate as string
dim Tick as long
dim NewTick as LOng

D=7
Tick=1234567688
P.Days=D
NewTick=DateUtils.AddPeriod(ticks,p)
NewDate=DateUtils.TicksToString(NextDate)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I don't see any method in dateutils that does what I need. Trust me, I checked already.
You did not look deep it seems.
B4X:
    Dim today As Long = DateTime.Now
    
    Dim per As Period
    per.Initialize
    per.Days = 7
    
    Dim futuredate As Long = DateUtils.AddPeriod(today,per)
    Log($"Date in Future $date{futuredate}"$)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…