Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can DateTime be set by just year, or month, or day? 2

Status
Not open for further replies.

Ovatvvon

Programmer
Feb 1, 2001
1,514
US
I am building a calendar on my web site for my users. I need code that will get JUST the year, or month, or day from DateTime so I can use it in my Sql Statement to extract the events for that specific user for the month. Does anyone know what that is?
Jim
 
There are two ways.

Use the format function: example Format(yourfield,"yyyy") see the Format Function section in access help for further information.

The second way is using Year,Month or day functions. examples:- Year(yourfield),Month(yourfield) or day(yourfield) to get the month of the current date use this Month(Date())

Hope this helps
Chris
cjr@belzona.co.uk
 
Chris's response prompts me to add a tip (that took me a while to realize): The regular Access Help is not very useful if you look up VBA functions such as "format." However, if you use the ALT+F11 combination to open the VBA editor and then press F1 you get VBA specific help and much better responses to searches for functions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top