Android Question day of week - a conflict

drgottjr

Expert
Licensed User
Longtime 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

  • date.png
    175.5 KB · Views: 187

keirS

Well-Known Member
Licensed User
Longtime User
Sunday is zero, so the code is correct, the documentation however, is another issue .

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
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime 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
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime 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
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
Where do you see it?

nowhere, obviously. i've given up my driver's permit due to vision issues. time for programming to go, as well. sigh
 

Attachments

  • stocks.png
    164.8 KB · Views: 156
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…