Simple Formattinmg Question

  • Thread starter Thread starter John Baker
  • Start date Start date
J

John Baker

Hi:


I need to set up the weeks in the year (based on input dates) so that they are all shown
as two digits. Weeks 1-9 will be 01,02,.... 09 and 10 + will all be two digits. This is so
I can do realistic compares between them.

I am using the format command thus (using currebt date as an example):

Format(DatePart("ww",Now()),"nn")

and all I am getting is 00. This should be 10 now (2/28/2005).

Can someone give me a simple way to get the result I need.

Thanks

John Baker
 
John Baker said:
Hi:


I need to set up the weeks in the year (based on input dates) so that
they are all shown as two digits. Weeks 1-9 will be 01,02,.... 09 and
10 + will all be two digits. This is so I can do realistic compares
between them.

I am using the format command thus (using currebt date as an example):

Format(DatePart("ww",Now()),"nn")

and all I am getting is 00. This should be 10 now (2/28/2005).

Can someone give me a simple way to get the result I need.

The format string you're providing is incorrect. Try this:

Format(DatePart("ww",Date()),"00")

I used Date() instead of Now(), because you're never going to care about
the time of day, but Now() would work, too.
 

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

Back
Top