Here’s my code:
Sub Test
Dim myDate As Date
Dim myDay As Integer
Dim myMonth As Integer
Dim myYear As Integer
Dim myWeekday As Integer
myDate = DateSerial(2017, 8, 15)
myDay = Day(myDate) 'Returns 0
myMonth = Month(myDate) 'Working
myYear = Year(myDate) 'Returns 0
myWeekday = WeekDay(myDate) 'Returns 0
msgBox myWeekday & ", " & myDay & ", " & myMonth & ", " & myYear & " = " & myDate
End Sub
I’ve read what I think are the latest guides. I’ve scoured the Interweb for my answer. Everything tells me that this should work. “Month” works fine, but the rest do not. What am I missing?
Thanks,
Greg