Android Question Date bug?

parpatola

Member
Ho everyone, Simeone can explain me why the date 29/10/2023 (only that date) repeats itself?

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
Private ListView1 As ListView
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
Dim i As Int
DateTime.DateFormat="MM/dd/yyyy"
ListView1.Color=Colors.Black
For i=0 To 10
ListView1.AddSingleLine(DateTime.Date(DateTime.DateParse("10/28/2023")+i*DateTime.TicksPerDay))
Next
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click

End Sub
 

Attachments

  • Screenshot_20230513-180420.png
    63.3 KB · Views: 133

Sagenut

Expert
Licensed User
Longtime User
I just used your code and it does not happen to me.
 

Attachments

  • date.jpg
    24.6 KB · Views: 107
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Simeone can explain me why the date 29/10/2023 (only that date) repeats itself?
I tried your code also and it ran as expected. I came up with the same result as Sagenut. If you continue to have problems, try using the Add function like this:
B4X:
ListView1.AddSingleLine( DateTime.Date(DateTime.Add(DateTime.DateParse("10/28/2023"),0,0,i)))
 
Last edited:
Upvote 0

parpatola

Member
ok, with datetime.add works fine, thanks. i have tried the other code with 2 different pc on 2 different smartphone and don't work, i don't know why. I'm italian , i used that code in a scrollview to calculate turn at work. scrolling the view my code works fine until the date was 10/29/2023 (i used 29/10/2023 according to data format "dd/MM/yyyy")
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…