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

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top