By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,473 Members | 1,267 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,473 IT Pros & Developers. It's quick & easy.

Function DatePart(), how to subtract the month from a date field

P: n/a
Dear reader,

With DatePart() you can subtract the year or the week from a date field
with:

DatePart("yyyy";[DateField]) for the year

DatePart("ww";[DateField]) for the week

But how can I subtract the month or the combination of year & month from a
date field?

DatePart("mmm";[DateField]) dos not work

Tanks for any help.

Kind regards,

Simon van Beek
Dec 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
S. van Beek wrote:
Dear reader,

With DatePart() you can subtract the year or the week from a date
field with:

DatePart("yyyy";[DateField]) for the year

DatePart("ww";[DateField]) for the week

But how can I subtract the month or the combination of year & month
from a date field?

DatePart("mmm";[DateField]) dos not work


Just use one "m".

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Dec 16 '05 #2

P: n/a

"S. van Beek" <S.******@HCCnet.nl> wrote in message
news:43*********************@textreader.nntp.hccne t.nl...
Dear reader,

With DatePart() you can subtract the year or the week from a date field
with:

DatePart("yyyy";[DateField]) for the year

DatePart("ww";[DateField]) for the week

But how can I subtract the month or the combination of year & month from a
date field?

DatePart("mmm";[DateField]) dos not work

Tanks for any help.

Kind regards,

Simon van Beek


Simon, I think you mean extract rather than subtract. Try:

DatePart("m", [DateField])
or
Month([DateField])

--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.

Dec 16 '05 #3

P: n/a
<fake pirate voice>
Actual lad, ye needs to use the DateAdd() funk-she-own.

DateAdd("m", -6, MyDate)

will return the date 6 months previous.

Arrrgh. matey

</fake pirate voice>

King Ron of Chi

Dec 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.