Android Question Help !! add month in date

Nkalampika

Active Member
Licensed User
Hello I want to add 3 months in an example date
var date = "13/01/2019"
var ndate = date + 3 months

!!! help me
 

DonManfred

Expert
Licensed User
Longtime User
!!! help me
This is of NO help for you to get help! NO need to use multiple "!" at all

Inform about the language you are using. Check the most promising Object Documentation which is probably DATETIME https://www.b4x.com/android/help/core.html#datetime

this alone should point you to the solution without the need to create a thread.

Here a adapted code from the Documentation.
B4X:
Dim threemonths As Long
threemonths = DateTime.Add(DateTime.Now, 0, 3, 0)
 
Last edited:
Upvote 0

Nkalampika

Active Member
Licensed User
thank you but I do not want a current date! I want it to work with a date I choose through a calendar that will return the chosen date in a variable and that I can increment of 3 months
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Here is an example of what Manfred is trying to help you with:
B4X:
Dim OrigDateFormat As String = DateTime.DateFormat
    DateTime.DateFormat="dd/MM/yyyy"   
    Dim DS As Long = DateTime.Add(DateTime.DateParse("13/03/2019"),0,1,0)  'add 3 months
    Dim date2 As String=DateTime.Date(DS) 'this is a string date
    Log(date2)  '13/04/2019
    DateTime.DateFormat=OrigDateFormat
 
Upvote 0
Top