B4J Question B4j DateTime Get Next Month ?

Addo

Well-Known Member
Licensed User
is there any possibity to get the next month from the current day ?

as example Today is 12/10/2020
i want to get the next month of 1/10/2021

any simple workaround ?

in php there is something like this

PHP:
$date = date('Y-m-d', strtotime('+1 month'));

is there equivalent function in b4j ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
Sub AppStart (Args() As String)
    Log(DateTime.Date(FirstDayOfNextMonth))
End Sub

Sub FirstDayOfNextMonth As Long
    Dim p As Period
    p.Months = 1
    Dim ThisDayNextMonth As Long = DateUtils.AddPeriod(DateTime.Now, p)
    Return DateUtils.SetDate(DateTime.GetYear(ThisDayNextMonth), DateTime.GetMonth(ThisDayNextMonth), 1)
End Sub
 
Upvote 0
Top