473,407 Members | 2,314 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,407 software developers and data experts.

DateTime span

How do I calculate the number of days (or hours, or minutes, etc) between
two DateTime's ?
Nov 17 '05 #1
2 6719
Subtract one from the other.
The result of this operation is a TimeSpan object (operator - (less) is
overloaded)...

--
Ravi Ambros Wallau
r w a l l a u @ s p r i n g w i r e l e s s . n e t

"JezB" <je***********@blueyonder.co.uk> wrote in message
news:OJ**************@TK2MSFTNGP12.phx.gbl...
How do I calculate the number of days (or hours, or minutes, etc) between
two DateTime's ?

Nov 17 '05 #2
DateTime1 - DateTime2 results in a TimeSpan structure. This structure allows
you the represent the timespan in hour, seconds, ticks days. etc

"JezB" wrote:
How do I calculate the number of days (or hours, or minutes, etc) between
two DateTime's ?

Nov 17 '05 #3

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

Similar topics

2
by: Jeff Shantz | last post by:
Hello, I'm developing a large statistics application for a call center. It often needs to calculate time spanning over months. For example, an agent's total talk time within 30 days. Since an...
2
by: Chris | last post by:
Hello, How can i convert a C++ CTime (4 bytes) into a C# DateTime ? (my CTime is read in a file). Thanks, -- Chris
4
by: John J. Hughes II | last post by:
I have several functions that save the time when they did certain tasks to an SQL table. This was working fine as far as I could tell but I now have systems that are updating thousands of records...
2
by: Daniel | last post by:
how to get the number of milliseconds between two System.DateTime objects
4
by: DWW | last post by:
System.DateTime returns a string with the date and time. I want to convert the time to an integer, for example, convert 10:24:45 to 102445. Much research has turned up a myriad of variations on...
8
by: ajs | last post by:
I have a process that verifies that a server is running. If the server stops responding I send an email to a support person. Now I want to add a downtime indicator so that my code does not send...
3
by: Lars Schouw | last post by:
I would like to to add a time span "1Y 2M 3W 20D" entered as a string to a date time how do I do that? Lars
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
14
by: shapper | last post by:
Hello, I have two nullable DateTime: begin and end. I need to find the range, in month, between both variables. If for some reason, for example begin is null, it is not possible to calculate...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
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...
0
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...
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.