473,626 Members | 3,041 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TimeSpan problem


I'm sure there's an easy solution to this that I am just not thinkin
of. I am trying to get the total minutes between 2 times. It work
fine except when the ending time crosses over midnight. For instance
I am trying to get the total minutes between 11:59 PM and 12:09 AM.
The subtract method on the TimeSpan object returns a crazy negativ
number. I can't seem to find a work around.

Thanks so much in advance!

--
Rosann
-----------------------------------------------------------------------
Rosanne's Profile: http://www.highdots.com/forums/member.php?userid=28
View this thread: http://www.highdots.com/forums/showthread.php?t=205285

Nov 19 '05 #1
1 1374
Rosanne,

You have to include dates in the values.

Eliyahu

"Rosanne" <Ro************ @no-mx.forums.yourd omain.com.au> wrote in message
news:Ro******** ****@no-mx.forums.yourd omain.com.au...

I'm sure there's an easy solution to this that I am just not thinking
of. I am trying to get the total minutes between 2 times. It works
fine except when the ending time crosses over midnight. For instance,
I am trying to get the total minutes between 11:59 PM and 12:09 AM.
The subtract method on the TimeSpan object returns a crazy negative
number. I can't seem to find a work around.

Thanks so much in advance!!
--
Rosanne
------------------------------------------------------------------------
Rosanne's Profile: http://www.highdots.com/forums/member.php?userid=283
View this thread: http://www.highdots.com/forums/showthread.php?t=2052856

Nov 19 '05 #2

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

Similar topics

5
2315
by: Dirk Reske | last post by:
hey, when I do: TimeSpan ts = TimeSpan.FromTicks(System.Enviroment.TickCount); ts.ToString(); I get something like this: 00:00:00.2381474 but I want to see, how many hours, minutes....this are...
2
21048
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 agent talks about 5 hours per day, this comes out to about 150 hours of talk time per month. Fine. But, the DateTime and TimeSpan format strings will only output hours from 0-23. I need something that will output time as such: 150:0:0 to...
2
19093
by: DWalker | last post by:
In Visual Studio (Visual Basic) .NET 2002, I noticed that this: Dim Elapsed as DateTime = Now - Now gives a "compile time" error (error in the IDE), saying that the '-' operator is not defined for the Date datatype. On the other hand, Dim Elapsed as DateTime = Now + Now does not give a compile time error but it thinks you're trying to
2
2938
by: ucasesoftware | last post by:
i translate a C# funtion to VB.NET and i have this : Shared Function isAllDay(ByVal ap As Appointment) As Boolean Return ap.DateBegin.TimeOfDay = TimeSpan.Zero AndAlso ap.DateEnd.TimeOfDay = TimeSpan.Zero End Function Error : = is not corret
13
2137
by: sd00 | last post by:
Hi all, can someone give me some coding help with a problem that *should* be really simple, yet I'm struggling with. I need the difference between 2 times (Target / Actual) However, these times will fall somewhere between a Start & End time Further more, there will be Break & Lunch times between Start & End. Example... Start 08:00 Break start 10:30
2
1070
by: Rob | last post by:
I was just getting started with TimeSpan and I get a error in my first line of code... I write... Dim ts as TimeSpan And Intellisense gives me an error "Type Expected" I did notice that there were 2 TimeSpan choices in the Intellisense drop
5
5506
by: prasanta.bhowmik | last post by:
Hello, I created a object of TimeSpan only with minute and expected the result in hours and minute, but its returning wrong result. My Code is : TimeSpan timeSpan = new TimeSpan(0,2400,0); Console.WriteLine(timeSpan.Hours+':'+timeSpan.Minutes); Its Displaying me the result is 16:00, but expected result is 40:00.
5
1992
by: Vibhesh | last post by:
I am facing problem with TimeSpan structure when DirectX is used. Following is the sample code that causes the problem: *************************************************************************************************************** { ........................... PrintTimeSpanProblem(); device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams); PrintTimeSpanProblem();
4
6235
by: Massimo | last post by:
Hi to All, i'm using C# in .NET 2.0 and i have a DataTable A with a column of type TimeSpan used to store HOUR info. I'm trying to filter my DataTable A selecting only rows that have the column HOUR .... if i try to Call A.Select( " HOUR '10:30:00' " ) i receive an error ( cannot compare TimeSpan with String ...) if i try to call A.Select ( " HOUR 10:30:00 " ) i receive an error ( invalid token : )
2
12620
by: shapper | last post by:
Hello, I have the following: boxStat = new BoxStat { BoxCount = database.Boxes.Count(), SinceLastCreate = (DateTime.Now - database.Boxes.Max(b => b.CreatedAt)).Days ?? 0 };
0
8259
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
8637
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...
0
8502
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
7188
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
6119
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
5571
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
4090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4195
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.