date count

  • Thread starter Thread starter manolakshman
  • Start date Start date
M

manolakshman

How do you count the number of days in a month without giving the start date
and end date. As everyone knows jan has 31 days, how do u get this info as
simple as it is from access
 
Given the input of any date (txtDate), these two functions, first get the
start date of the month, then days in that month:

dteStartDate = txtDate - Day(txtDate) + 1
intDays = Day(DateAdd("m", 1, dteStartDate) - 1)

Taken from Allen Browne's date picker.

HTH

Rico
 
Given any date the following expression will return the number of days in the
month.

Day(DateSerial(Year([DateValue]),Month([DateValue)+1,0)

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
John Spencer said:
Given any date the following expression will return the number of days in
the month.

Day(DateSerial(Year([DateValue]),Month([DateValue)+1,0)

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

What a brilliant little expression John, I've added it to my library -
thanks! There seem to be a couple of typos, this example works for me:

Day(DateSerial(Year([DateValue]),Month([DateValue])+1,0))

Regards,
Keith.
 
Thanks John and Keith. It really works


Keith Wilby said:
John Spencer said:
Given any date the following expression will return the number of days in
the month.

Day(DateSerial(Year([DateValue]),Month([DateValue)+1,0)

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

What a brilliant little expression John, I've added it to my library -
thanks! There seem to be a couple of typos, this example works for me:

Day(DateSerial(Year([DateValue]),Month([DateValue])+1,0))

Regards,
Keith.
 
Back
Top