Android Question Another Date Picker

sparks9941

Member
Licensed User
How can I add 1 year to the date that is picked in Another Date Picker and put the result in a label text
 

sparks9941

Member
Licensed User
Thank you, but could you be a little more specific, i am new to this.
Do I need to declare newtime as ?
(timefromDatepicker,per) is timefromDatepicker anotherdatepicker.getdate?
 

Mahares

Well Known Member
Licensed User
B4X:
Dim per As Period
dim newtime as long
per.Years = 1
newtime = DateUtils.AddPeriod(anotherdatepicker.getdate,per)
Label1.Text = DateTime.Date(newtime)
 

sparks9941

Member
Licensed User
Thank you, where would I declare this code. My label just says 12/31/1970 and doesn't change when i select another date from anotherdatepicker
 

Mahares

Well Known Member
Licensed User
Here is a small example that has 3 labels: One label to show picker, one label to add 1 year and a label to hold the final date with the year added. I hope it helps:
 

Attachments

Top