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

Count number of elapsed days in a year

P: n/a
Can anyone post any code that will count the number of elapsed days in
a year? I want code that tells me 1/1/2004 is day 1, 2/1/2004 is day
32, etc.
I plan to use this in a calendar that caculates people's birthdays
from today's date using a SQL server SP.
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 6 Jan 2004 14:24:14 -0800, la*************@hotmail.com (Lauren
Quantrell) wrote:
Can anyone post any code that will count the number of elapsed days in
a year? I want code that tells me 1/1/2004 is day 1, 2/1/2004 is day
32, etc.
I plan to use this in a calendar that caculates people's birthdays
from today's date using a SQL server SP.


Take a look at the DateDiff function. For example ...

?DateDiff("d",DateSerial(year(date()),1,1)-1,#2/1/04#)
32

?DateDiff("d",DateSerial(year(date()),1,1)-1,Date())
6
- Jim
Nov 12 '05 #2

P: n/a
?Format(#2/1/2004#, "y")
32
?Format(#2/29/2004#, "y")
60
?Format(#12/31/2004#, "y")
366

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"Lauren Quantrell" <la*************@hotmail.com> wrote in message
news:47**************************@posting.google.c om...
Can anyone post any code that will count the number of elapsed days in
a year? I want code that tells me 1/1/2004 is day 1, 2/1/2004 is day
32, etc.
I plan to use this in a calendar that caculates people's birthdays
from today's date using a SQL server SP.

Nov 12 '05 #3

P: n/a
la*************@hotmail.com (Lauren Quantrell) wrote in
news:47**************************@posting.google.c om:
Can anyone post any code that will count the number of elapsed days in
a year? I want code that tells me 1/1/2004 is day 1, 2/1/2004 is day
32, etc.
I plan to use this in a calendar that caculates people's birthdays
from today's date using a SQL server SP.


HMMM ... Where will you use this "code" ... VBA ... or in the SPROC itself?

VBA: DatePart("y", Date)

T-SQL: DATEPART(y, DATE)

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.