I am trying to get the Date as a string formatted yyyy-mm-dd
.
I have tried various things with strange results:
Dim mydate As String
mydate = Date
mydate = Year(Date)
mydate = Month(Date)
mydate = Day(Date)
11/02/
without the year.I can try to concatenate the data but:
Any clarification or an example would be very welcome.
Use the Format
function from the VBA.Strings
built-in module:
Debug.Print Format(Now, "YYYY-MM-DD")