Android Question day of week - a conflict

drgottjr

Well-Known Member
Licensed User
it's 1400h (new york time), march 27, 2015 as i write this. my device indicates a friday

however, my app says march 27, 2015 is day 6. (per attached image)

here's the code:
Dim now As Long = DateTime.now
Dim hour As Int = DateTime.GetHour(now) ' 0-23
Dim day As Int = DateTime.GetDayOfWeek(now) ' 1-7 7=sunday

Msgbox( DateTime.Date(now) & " hour = " & hour & " " & "day = " & day,"")


i normally don't use datetime functions, and since the documentation says sunday is day 7, friday should be day 5. the msgbox output came as a surprise. how did i mess this up?

-go
 

Attachments

keirS

Well-Known Member
Licensed User
Sunday is zero, so the code is correct, the documentation however, is another issue :D.
Err no. Sunday is 1. If Sunday was 0 then Friday would be 5.

0= Sunday
1=Monday
2=Tuesday
3=Wednesday
4=Thursday
5=Friday
6=Saturday



1= Sunday
2=Monday
3=Tuesday
4=Wednesday
5=Thursday
6=Friday
7=Saturday
 

drgottjr

Well-Known Member
Licensed User
i see. it looks like i'll have to wait until sunday and run the app again ...
android calendar functions define days of week as 1 - 7 (regrettably, not saying which is which).

for my purposes i just need to know when it's "friday". i expected 5, but 5, 6, whatever. app says friday = 6. in either case sunday doesn't appear to be 7. thanks, all (or both)

-go
 

drgottjr

Well-Known Member
Licensed User
thanks. looks like it was remission until i revived it. my apologies. i can't wait until tomorrow (sunday). if the eu designed an os, 0, 1, 6 or 7 would all be acceptable for sunday; so let us give thanks.:)

-go
 
Top