Simple Formattinmg Question

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
 
D

Dirk Goldgar

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.
 
Top