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

DatePart(m, [foo]) not accounting for year?

P: n/a
I just discovered this, as the new year rotated in.

I've got a little snip like this

TXT.Caption = DatePart(m, Date - DateReceived)

Well, it works fine, say if the DateReceived is 1/1/06 and it's
currently 12/1/06 it'll say 11.

However, now that it's 2007, I have a date that's 12/15/99 and it's now
1/10/07, it says they're only a month apart.. not 96 months apart (or
whatever).

This also applies for 12/15/05 to 12/15/06, it doesn't say it's 12
months apart, it says they're zero.

How can I have datepart account for the year also?

Jan 10 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I think you need DateDiff instead of DatePart ...

Arno R
"Ryan" <mi********@gmail.comschreef in bericht news:11**********************@77g2000hsv.googlegro ups.com...
>I just discovered this, as the new year rotated in.

I've got a little snip like this

TXT.Caption = DatePart(m, Date - DateReceived)

Well, it works fine, say if the DateReceived is 1/1/06 and it's
currently 12/1/06 it'll say 11.

However, now that it's 2007, I have a date that's 12/15/99 and it's now
1/10/07, it says they're only a month apart.. not 96 months apart (or
whatever).

This also applies for 12/15/05 to 12/15/06, it doesn't say it's 12
months apart, it says they're zero.

How can I have datepart account for the year also?
Jan 10 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.