473,399 Members | 3,656 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Count number of elapsed days in a year

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
3 10239
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
?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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Tux | last post by:
How can I calculate number of days between two dates?
7
by: Shuffs | last post by:
Could someone, anyone please tell me what I need to amend, to get this function to take Sunday as the first day of the week? I amended the Weekday parts to vbSunday (in my code, not the code...
18
by: jimfortune | last post by:
I have an A97 module called modWorkdayFunctions in: http://www.oakland.edu/~fortune/WorkdayFunctions.zip It allows the counting of workdays taking into consideration up to 11 U.S. holidays. ...
10
by: Scott Kilbourn | last post by:
Hi, Does anyone know how to accurately calculate the number of days that have elapsed since 01/01/0000? I'd appreciate any help anyone could give me. Thanks
20
by: none | last post by:
I have managed to get the below script *almost* working. However, it still has a problem calculating the number of months. The date I am trying to calculate from is Oct 15, 1994. With the correct...
5
by: Beemer Biker | last post by:
I cant seem to get that date into any DateTime to make my calculation directly by subtracting "01-01-0000" from "now". After reading this:...
1
by: muld | last post by:
I've inherited a database system designed to calculate sickness absence statistics. There is a main table with an employee ID which also holds the number of days worked by that person in a year ....
0
by: Gabriel Genellina | last post by:
En Fri, 02 May 2008 16:13:41 -0300, Simon Pickles <sipickles@googlemail.comescribió: Two options: a) You can construct a datetime object with that info, using...
14
by: Tommy Jakobsen | last post by:
Hi. Is there a method in .NET that takes "year" as an argument and returns the total number of weeks in that year? For culture da-DK (Danish). Thanks in advance. Tommy.
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.