adding days to a date and geting the result

tufanv

Expert
Licensed User
Longtime User
Hello,

Is it possible to add days to a date and find the new date .? For example the user enter a date of 15/9/1987 . The app must add 25 days to it and give the new result of : 10/10/1987 . Is it possible ?

Thank you
 

nrasool

Member
Licensed User
Longtime User
Yes, Datetime.add would be want you want to use, eg an example is

B4X:
Dim 25Date As Long
Dim 25Date = DateTime.Add(DateTime.Now, 0, 0, 25)

Kind Regards
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
Thank you I got it but i dont want to add it to datetime.now i want to add it to a specific date. How can i add it to a specific date ?
 
Upvote 0

nrasool

Member
Licensed User
Longtime User
Instead of using datetime.now, you would use the date.input. If in your code you had an example of

B4X:
Dim Dd As DateDialog
Dim return as int
return = Dd.Show("Date", "Test", "Save", "Cancel","Np",Null)

Then using the above would be
B4X:
Dim 25Date As Long
Dim 25Date = DateTime.Add(dd.input, 0, 0, 25)

I'm using agraham dialog library, don't know about standard, but it shouldn't be that different

Kind Regards
 
Upvote 0
Top