Android Question Date calculations

Declan

Well-Known Member
Licensed User
Longtime User
How can I get the following dates:
Yesterday
Month To Date
Last Month
Last Month to Date
Last Year
Last Year to Date
Last 7 days
Last 30 days
Last 60 days
Last 90 days
This Calendar Quarter
This Calendar Quarter to Date
Last Calendar Quarter
Last Calendar Quarter to Date
Last Year Calendar Quarter
Last Year Calendar Quarter to Date
 

Declan

Well-Known Member
Licensed User
Longtime User
Thanks, I have looked at DateUtils.
What I need to do is:
B4X:
NewDate = (DateTime.Date(DateTime.Now) - 1 day)
etc.
That would give me yesterday
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
B4X:
    Dim today As Long = DateTime.Now
    Dim p As Period
    p.Days = -1
    Dim newdate As Long = DateUtils.AddPeriod(today,p)
    Log(DateTime.Date(newdate))
Note to check dateutils in libs tab
 
Upvote 0
Top