datetime bug?

dougc

Member
Licensed User
Longtime User
on my system running 2.50 the below code is returning 28 and not 29 (today is the 29th). I have verified that my system date is correct (1/29/2013).

B4X:
currentDay = DateTime.GetDayOfMonth(DateTime.Now)

I have defined currentDay as a string, could that be the issue (I did that so I could split the numbers)

dougc
 

klaus

Expert
Licensed User
Longtime User
Tested on my devices:
Nexus One smartphone Android 2.3.3
Asus TF700 tablet Android 4.1.1

I get 29 on both !?
with the result variable Type as Int and also as String.

Best regards.
 

dougc

Member
Licensed User
Longtime User
datetime bug

I believe you but on my system (windows 8 professional) the below code logs

B4X:
Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   Activity.LoadLayout("years")
   
   currentMonth = DateTime.GetMonth(DateTime.Now)
   currentDay = DateTime.GetDayOfMonth(DateTime.Now)
   Log("running DateTime.GetDayOfMonth(DateTime.Now) sets currentDay to = " & currentDay)
   
    get_years
   get_months
   get_days

End Sub


** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (years) Create, isFirst = true **
running DateTime.GetDayOfMonth(DateTime.Now) sets currentDay to = 28

wierd, I can work around it by adding one to the results but not sure why this is happening to me and not you .......

dougc
 

dougc

Member
Licensed User
Longtime User
sorry I found the problem, the emulator has the date of the 28th

sorry about that

dougc
 
Top