can anyone help me to add day,month and year to this sub:
B4X:
Sub ConvertMillisecondsToString(t As Long) As String
Dim hours, minutes, seconds As Int
hours = t / DateTime.TicksPerHour
minutes = (t Mod DateTime.TicksPerHour) / DateTime.TicksPerMinute
seconds = (t Mod DateTime.TicksPerMinute) / DateTime.TicksPerSecond
Return $"$1.0{hours}:$2.0{minutes}:$2.0{seconds}"$
End Sub
Dim today As Long = DateTime.Now
Dim twodays As Long = DateTime.Add(today,0,0,2) ' Add 0 Years, 0 Months, 2 Days
Log(ConvertMillisecondsToString(twodays))
DateFormat is relevant if you want to convert a specific instance of time to a date string.
Assuming that the question is about periods then the correct way to do it is with DateUtils.PeriodBetween.
However there isn't enough context in the question to really answer it.