05-04-2022, 04:43 PM
Code: (Select All)
a$ = Date$
month$ = Left$(Date$, 2)
day$ = Mid$(Date$, 4, 2)
Select Case month$
Case "01": datenum = 0 ' jan 31
Case "02": datenum = 31 ' feb 29+ F leap years
Case "03": datenum = 60 ' mar 31+
Case "04": datenum = 91 ' apr 30+
Case "05": datenum = 121 ' may 31+
Case "06": datenum = 152 ' jun 30+
Case "07": datenum = 182 ' jul 31+
Case "08": datenum = 213 ' aug 31+
Case "09": datenum = 244 ' sep 30+
Case "10": datenum = 274 ' oct 31+
Case "11": datenum = 305 ' nov 30+
Case "12": datenum = 335 ' dec 31+
End Select
datenum = datenum + Val(day$)
datenum$ = Right$("00" + _Trim$(Str$(datenum)), 3)
Print a$
Print month$
Print day$
Print datenum$
End
I wanted to simplify the code with a edit. Messaged up the message big time. So I deleted and retried. If you remember my previous post. You will notice the change after the end select and in each case. This will result in faster and smaller code, with no difference in performance.