Hello, Is there other possibility to represent number of day in forrmat xx, eg if day is 1 i would like to see 01, and the same with month, as you can see bellow i am checking Len(MyMonth) to add 0 if month has 1 number. I tried to use:
DatePart("mm", dt) but its not working.
DatePart("mm", dt) but its not working.
Dim dt As Date = Now
Dim MyYear As String = DatePart("yyyy", dt)
Dim MyMonth As String = DatePart("m", dt)
Dim MyDay As String = DatePart("d", dt)
Dim MyFileName As String
If Len(MyMonth) = 1 Then
MyFileName = "Report1_" & MyYear & "-" & "0" & MyMonth & "-" & MyDay & ".xls"
Else
MyFileName = "Report1_" & MyYear & "-" & MyMonth & "-" & MyDay & ".xls"
End If
FName = OutDir & MyFileName