how to get year and month value from date field (1 Viewer)

spec

Registered User.
Local time
Today, 00:53
Joined
Jun 9, 2005
Messages
12
hi friends,

I want to get year and month field of datetime field so that i can get data by comparing them with other table fields.

ex: date field column contains 1/28/2005 as data
how to get year(1/28/2005)
how to get month(1/28/2005)


expecting your help

Thanks,
Spec
 

ColinEssex

Old registered user
Local time
Today, 08:53
Joined
Feb 22, 2002
Messages
9,117
Never expect help :rolleyes: you'll be disappointed when it doesn't come

Look up the Format() function in Access help

Col
 

neileg

AWF VIP
Local time
Today, 08:53
Joined
Dec 4, 2002
Messages
5,975
Also look at DatePart() while you're in the help files.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 03:53
Joined
Feb 19, 2002
Messages
43,223
And then there are the named functions - Year() and Month()

Where Year(fld1) = Year(fld2) and Month(fld1) = Month(fld2).

If you need to use ranges, your best alternative is the Format() function but don't forget to put the year first.

Where Format(fld1, "yyyymm") Between Format(fld2, "yyyymm") and Format(fld3, "yyyymm")
 

Users who are viewing this thread

Top Bottom