473,416 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

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

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
3 9845
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

"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
<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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: wolftor | last post by:
Month(date) shows the month number. Is there a way to get the month name ie. October? -- Regards, Peter
1
by: Liz Malcolm | last post by:
Hello and TIA. I have a DE form with an option group that if daily is selected todays date is used for start and end date, if weekly is selected Monday - Friday is used. I am trying to add a...
4
by: S. van Beek | last post by:
Dear reader, By a Date field with Now() as default value the content of the field is date plus time. As I need a filter in a query on date only (excluding time) I invented the following...
3
by: S. van Beek | last post by:
Dear reader, I need to know which day of the week belongs to a date field. 30 June 2005 is Thursday
1
by: Graham Feeley | last post by:
I have a date field named rcdate it is a general date eg: 12/08/2006 3:30:00 PM 12/08/2006 3:00:00 PM I used to update another empty field named rdate with the with using in a update query "...
1
by: lisa.moffitt | last post by:
How can I create a field in a view that takes a date field and converts it to a month? For instance, if I have a field called "CreatedOn" with a date of '2/22/2007', how can I create another field...
1
by: Simon | last post by:
Dear reader, Is there a function or VBA code available to find the week number out of a date field. You can find the year with Year(date field) but now I need the week number out of a...
10
by: Jes | last post by:
Dear all I have a date field on a HTML form where the user is asked to key in dd/mm/yyyy However, when that is written to MySql it is either not accepted or another value is tored in the...
2
by: Benniit | last post by:
I'm using vb.net 2008 and sqlserver 2008 and I want subtract a date from a specified date. Example: I want to subtract Commencedate from Today's Date but when I used datediff it gave me (argument...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.