Whats the code behind the weekday function? i need a simple fast algoritm that calculates what day it is :)
Printable View
Whats the code behind the weekday function? i need a simple fast algoritm that calculates what day it is :)
Have a look
WeekdayName(weekday, abbreviate, firstdayofweek)
The WeekdayName function syntax has these parts:
Part Description
weekday Required. The numeric designation for the day of
the week. Numeric value of each day depends on setting of the firstdayofweek setting.
abbreviate Optional. Boolean value that indicates if the weekday name is to be abbreviated. If omitted, the default is False, which means that the weekday name is not
abbreviated.
firstdayofweek Optional. Numeric value indicating the first
day of the week. See Settings section for values.
Settings
The firstdayofweek argument can have the following values:
Constant Value Description
vbUseSystem 0 Use National Language Support (NLS) API setting.
vbSunday 1 Sunday (default)
vbMonday 2 Monday
vbTuesday 3 Tuesday
vbWednesday 4 Wednesday
vbThursday 5 Thursday
vbFriday 6 Friday
vbSaturday 7 Saturday
[]P
Eh, nope that's not what i need. I need to get the weekday from a date, without using a vb function, and it could return an index as well...
OK, here's my chance to help a guru! Try this, kedaman:
The source for this came from the following link:Code:Function DayOfWeek(lngYear As Long, lngMonth As Long, lngDay As Long) As Long
' sample call: lngMyDOW = DayOfWeek(2000, 11, 12)
' the value returned will be from 0 to 6, which is Sunday to Saturday
If lngMonth < 3 Then
lngYear = lngYear - 1
lngMonth = lngMonth + 12
End If
DayOfWeek = (lngDay + (153 * lngMonth - 457) \ 5 + 365 * lngYear + lngYear \ 4 - lngYear \ 100 + lngYear \ 400 + 2) Mod 7
End Function
http://www.capecod.net/~pbaum/date/date0.htm
Thanks! that exactly what i needed :)
Hey VB Gurus Please help me !
I want to send Month and Year as parameters to Crystal Report. And want to display all dates and days in that month. For this purpose I have created labels from 1 to 31. But how to send parameters to Crystal Report and how to figure out Days for each date ???