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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Number of days in DateField

Status
Not open for further replies.

gudguy

MIS
Nov 8, 2002
93
US
Hello,

I just need your expertise on date formula in Access.

I'm running Access Query, in which I'm adding a new field that outputs the number of days in a month.


Ex.: MY fields in Access Query is:

StartDate Users Expr1 (new field Im adding)
7/7/04 20 Number of days in StartDate field


In Expr1 field, I want to insert a formula to output number of days in 'startdate' field.


Thank you for your help in advance
 
SELECT tblStrtDt.StartDate, Format(DateSerial(Year([StartDate]),Month([StartDate])+1,0),"dd") AS NumDays
FROM tblStrtDt;




MichaelRed
mlred@verizon.net

 
Thank you for your reply. I looked at the link. I'm not sure if this script works in Access Query in the Expr field.

Wondering if there is a simple return of number to month. There are many 'builtin functions with onversions in date/time for complex date calculations, but couldn't find a simple formula to get number of days in a month.

Anyway, can I copy and paste this script in Microsoft Access Query field?
 
Have you tried this ?
Expr1: Format(DateSerial(Year([StartDate]),Month([StartDate])+1,0),"dd")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top