Hi,
I have a simple script like below:
s = "11/26/1939"
' not sure how to parse the string, so using manual method for now.
dD = s.SubString2(3,5)
dM = s.SubString2(0,2)
dY = s.SubString(6)
' anyway, as i'm using dd/mm/yy, I need to reset it
DateTime.DateFormat = "MM/dd/yyyy"
dt = DateTime.DateParse(dM & "/" & dD & "/" & dY)
' set the date as I want to have the day string as well
DateTime.DateFormat = "d MMM yyyy, EEEE"
s2 = DateTime.Date(dt)
Label2.Text = "BirthDate: " & s2.ToUpperCase
The result is shown as: Birthdate: 25 NOV 1939, SATURDAY
When it should be: Birthdate: 26 NOV 1939, SUNDAY
I then did some sample script using DateDialog:
Dim Dd As DateDialog
DD.DayOfMonth = 26
DD.Month = 11
DD.Year = 1939
dt = dd.DateTicks
s2 = DateTime.Date(dt)
Msgbox(s2,"Info")
The result is the same - it's showing 25 Nov 1939
And now... further observations:
The date works correctly in emulator but not in the device.
Most of the time, it's a day earlier. I also noticed that if the year is 18xx, it is OK. But when it's 19xx, it's not.
Have anyone encounter similar problem with the above code in your device or emulator?
Rgds
WZ Sun