Simple date format question from a new guy

  • Thread starter Thread starter tom c
  • Start date Start date
T

tom c

I want to put the date in Year, Month, Day format so todays date,
7/8/2006, will give me 20060708.

The following code code leaves out the zeros for day and month and
gives me 200678

Dim RptDate As String
Dim wkDate As Date
wkDate = Today
RptDate = wkDate.Year & wkDate.Month & wkDate.Day

What is the easiest way to get the format I want?
 
I found the answer:

RptDate = Format(Today, "yyyyMMdd")

I wish they were consistent with making month lower case like year and
day
 
Back
Top