473,789 Members | 2,617 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

days between two dates

What is formula that get days between two dates?
Npr: 11.03.1998 – 1.7.2005

Thank you, Mojca
Nov 13 '05 #1
8 10018
If dates are in Field1 and field2 and provided both of these are datetime
datatype containing just dates and no time values then you can just take
one from the other.

Result = Field1-field2

Peter
Mojca previously wrote:
What is formula that get days between two dates?
Npr: 11.03.1998 – 1.7.2005

Thank you, Mojca


Nov 13 '05 #2
On 6 Jul 2004 01:23:27 -0700, ki********@yaho o.com (Mojca) wrote:

I prefer to always use the DateDiff function.
-Tom.
What is formula that get days between two dates?
Npr: 11.03.1998 – 1.7.2005

Thank you, Mojca


Nov 13 '05 #3
Ray
ki********@yaho o.com (Mojca) wrote in message news:<d5******* *************** ****@posting.go ogle.com>...
What is formula that get days between two dates?
Npr: 11.03.1998 ? 1.7.2005

Thank you, Mojca


Hello Mojca,

My first question is, how many fields are being used for
your dates?

If one field, then:

(This expression uses the exact dates in the criteria)

Between #11/03/1998# and #01/07/2005#

(The following expression will pop up two windows that ask for
your starting and ending dates]

Or Between [Enter Starting Date] and [Enter Ending Date]
If two fields, the check out the DateDiff function.

Regards,

Ray
Nov 13 '05 #4
Tom van Stiphout <no************ *@cox.net> wrote in
news:9f******** *************** *********@4ax.c om:
On 6 Jul 2004 01:23:27 -0700, ki********@yaho o.com (Mojca) wrote:

What is formula that get days between two dates?
Npr: 11.03.1998 – 1.7.2005


I prefer to always use the DateDiff function.


When you're calculating days, what's the advantage of DateDiff()
over simply subtracting the dates?

If you assume that your values have no time component (I seldom use
date fields with time components myself, so that's a safe assumption
in my own work), then, because the date value is stored in the
integer value of the date, subtracting the earlier from the later
will always return an accurate number of days between the two dates.

Right?

DateDiff() is indispensable for calculating differences in weeks or
months or quarters or years, though.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #5
On Tue, 06 Jul 2004 16:33:11 GMT, "David W. Fenton"
<dX********@bwa y.net.invalid> wrote:

It's just a matter of being consistent and explicit.
As a former C++ programmer I think: that's a lot of trouble to support
date math like A-B: I have to overload the - operator. If I'm smart
I'll implement it by calling DateDiff. As a beginner programmer I can
never remember whether A-B only works for days, or seconds, or years?
What's so special about days anyway to warrant that exception? If I'm
MSFT and rewritinng the language like we do every couple of years,
perhaps I'll just yank that feature altogether because it's
inconsistent. (I haven't checked if A-B for dates is still supported
in .NET, but they did yank other inconsistent features).

-Tom.

Tom van Stiphout <no************ *@cox.net> wrote in
news:9f******* *************** **********@4ax. com:
On 6 Jul 2004 01:23:27 -0700, ki********@yaho o.com (Mojca) wrote:

What is formula that get days between two dates?
Npr: 11.03.1998 – 1.7.2005


I prefer to always use the DateDiff function.


When you're calculating days, what's the advantage of DateDiff()
over simply subtracting the dates?

If you assume that your values have no time component (I seldom use
date fields with time components myself, so that's a safe assumption
in my own work), then, because the date value is stored in the
integer value of the date, subtracting the earlier from the later
will always return an accurate number of days between the two dates.

Right?

DateDiff() is indispensable for calculating differences in weeks or
months or quarters or years, though.


Nov 13 '05 #6
ra*****@excite. com (Ray) wrote in message news:<20******* *************** ****@posting.go ogle.com>...
ki********@yaho o.com (Mojca) wrote in message news:<d5******* *************** ****@posting.go ogle.com>...
What is formula that get days between two dates?
Npr: 11.03.1998 ? 1.7.2005

Thank you, Mojca
Hello Mojca,

(The following expression will pop up two windows that ask for
your starting and ending dates]

Or Between [Enter Starting Date] and [Enter Ending Date]


Although, as you have discovered, this technique will produce results,
most Access programmers would consider this technique to be somewhat,
err.. Neanderthal. They would rather seduce the cavewomen than bonk
them on the head (How's that for anachronism? :-)). The bonk refers
to the somewhat brutal Query interface and the seduction refers to a
more visually attractive, friendly and possibly errorproof Form. I
once used an InputBox to get a Report title so I am guilty of this
also, but I'm trying to become civilized. It's like using
Command1_Click( ). It works, but style points are lost. Of course,
programmers like to nit-pick about minutiae like techniques that take
nanoseconds off execution time so don't take every suggestion too
seriously.

James A. Fortune
Nov 13 '05 #7
Tom van Stiphout <no************ *@cox.net> wrote in
news:ll******** *************** *********@4ax.c om:
It's just a matter of being consistent and explicit.
As a former C++ programmer I think: that's a lot of trouble to
support date math like A-B: I have to overload the - operator. If
I'm smart I'll implement it by calling DateDiff. As a beginner
programmer I can never remember whether A-B only works for days,
or seconds, or years? What's so special about days anyway to
warrant that exception? If I'm MSFT and rewritinng the language
like we do every couple of years, perhaps I'll just yank that
feature altogether because it's inconsistent. (I haven't checked
if A-B for dates is still supported in .NET, but they did yank
other inconsistent features).


I don't know how anyone could work with dates at all in Access and
not keep track of exactly why A-B works for days -- it's part and
parcel of the basic definition of how dates are stored (the integer
part of the double is the number of days since the starting point,
which I forget, because it's never important to me).

MS could not "yank" this feature unless they changed the way dates
are stored in Jet and VBA.

So, I still don't see a justification for using DateDiff() to get
number of days.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #8
"David W. Fenton" <dX********@bwa y.net.invalid> wrote in
news:Xn******** *************** ***********@24. 168.128.86:
Tom van Stiphout <no************ *@cox.net> wrote in
news:ll******** *************** *********@4ax.c om:
It's just a matter of being consistent and explicit.
As a former C++ programmer I think: that's a lot of trouble to
support date math like A-B: I have to overload the - operator. If
I'm smart I'll implement it by calling DateDiff. As a beginner
programmer I can never remember whether A-B only works for days,
or seconds, or years? What's so special about days anyway to
warrant that exception? If I'm MSFT and rewritinng the language
like we do every couple of years, perhaps I'll just yank that
feature altogether because it's inconsistent. (I haven't checked
if A-B for dates is still supported in .NET, but they did yank
other inconsistent features).
I don't know how anyone could work with dates at all in Access and
not keep track of exactly why A-B works for days -- it's part and
parcel of the basic definition of how dates are stored (the integer
part of the double is the number of days since the starting point,
which I forget, because it's never important to me).


ROFL! Did you READ this paragraph before you clicked "Send"?
MS could not "yank" this feature unless they changed the way dates
are stored in Jet and VBA.
What if they stopped evil type coercion? ("Tis a consummation
devoutly to be wished")! Do you think VBA subtracts the Dates, or first
converts the Dates to Doubles and then subtracts?
So, I still don't see a justification for using DateDiff() to get
number of days.


Date - OtherDate returns a Double.
DateDiff(interv al, date1, date2) returns a Long.
What else?

--
Lyle
--
use iso date format: yyyy-mm-dd
http://www.w3.org/QA/Tips/iso-date
--
The e-mail address isn't, but you could use it to find one.
Nov 13 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3423
by: David Mitchell | last post by:
I have tried using the following code to count the specific number of each weekday but get a compile error "User defined type not defined" which I think relates to the first line of the function: - Public Function HowManySpecificDays(StartDate As Date, EndDate As Date) As DayCounts and specifically the word "DayCounts" Can anyone help?
4
7799
by: Russell | last post by:
I have an assignment that I have to complete. I have to write a windows app in C#. Here is the spec: 1/ Date Comparison Build a program that will find the number of days between two dates. You CANNOT use the inbuilt date functions or the DateTime Type. Your program should work with any date between 1900 and 3000. Here are your acceptance tests:
29
9135
by: james | last post by:
I have a problem that at first glance seems not that hard to figure out. But, so far, the answer has escaped me. I have an old database file that has the date(s) stored in it as number of days. An example is: 36,525 represents 01/01/1900. The starting point date is considered to be : 00/00/0000. I have looked thru Help and used Google and have not really found an answer. I know that Leap Years need to be accounted for too. Any...
2
2959
by: bufbec | last post by:
I have worked on this for hours and can't come up with a solution. Hope someone can help me. I have a table called TMBS_HMAUDIT_PARMS. this table contains data to tell me how often a person is allowed to receive services for various programs we offer. columns in this table include PROGRAM_NAME, PROGRAM_ID, ALLOWED_PER_MONTHS. In the ALLOWED_PER_MONTHS column, a numerical value of '9' in the 'ALLOWED PER MONTHS' column means a person is...
2
3119
by: tasmontique | last post by:
I am working on an access 2002 flight schedule database. I am new to access but have some basic understanding of sql and vb6 code. I have learned a lot from this website. Thanks much Hopefully you can help me with this one. This database handles a varying number of flights for a varying number of days for a varying number of months. I have a number of tables as follows. I tried to normalize to the best of my ability.
2
2800
by: angi35 | last post by:
Hi, I'm working in Access 2000. I have a form with a series of date fields, showing the progress of a project from start to completion. There's a set of fields/controls for projected dates (when the project is projected to enter each stage of the process) and another set for actual dates. For my purposes, I'm only working with the projected dates. There is a formula, based on the size of the project (how many hours it will take), for...
5
24556
FishVal
by: FishVal | last post by:
IMHO, the following is not a how-to-do instruction to solve a particular problem but more a concept-proof stuff demonstrating possibilities of SQL. So, let us say the problem is to calculate business days count which is defined as count of days (optionally inclusive in the current implementation) excluding weekend days and holidays. Let us say periods to calculate are stored in table associated with contacts. keyPeriodID -...
1
1577
by: geraldjr30 | last post by:
hi, i have the following to calculate working days between 2 dates, but i am not getting the right amount. i should be getting 11 instead of 12, because feb 16 2009 was a holiday. can someone please advise? here is my code: <?php //The function returns the no. of business days between two dates and it skips the holidays function getWorkingDays($startDate,$endDate,$holidays){ //The total number of days between the two dates. We...
0
1894
by: geraldjr30 | last post by:
hi, i have the following: <?php echo"test"; //The function returns the no. of business days between two dates and it skips the holidays function getWorkingDaysTOT($startDate2,$endDate2,$HOLS){ //The total number of days between the two dates. We compute the no. of seconds and divide it to 60*60*24
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10199
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.