Simple date format question from a new guy

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?
 
T

tom c

I found the answer:

RptDate = Format(Today, "yyyyMMdd")

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top