DatePart WW

H

Harmannus

Halo,

I need to extract the week and year from a datefield in the format ww-yyyy
e.b 02-2004

The below code gets the job done but i can't figure out how to get a leading
0. Tried the format command by no luck..

Any suggestions on how to acomplish this?

Week:DatePart("ww";[DateField]) & "-" & Year([DateField])

01-10-2004 should give the result 02-2004 in stead of 2-2004 (as the above
code does).


Regards,
Harmannus
 
B

Bas Cost Budde

Harmannus wrote:

Week:format(DatePart("ww";[DateField]),"00) & "-" & Year([DateField])
 
H

Harmannus

Thanx for the reply!

Works fine!

Hoi Bas,

<NL>Dank voor de snelle reactie! Mooie familiefoto's. Jouw kleine doet het
zware programmeer werk :)</NL>


Bas Cost Budde said:
Bas Cost Budde wrote:

That should have been
Harmannus wrote:
Any suggestions on how to acomplish this?
Yes: my suggestion is

Week:format(DatePart("ww";[DateField]),"00) & "-" & Year([DateField])
 

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

Top