Click here to Skip to main content
15,888,610 members
Home / Discussions / C#
   

C#

 
AnswerRe: Time Difference Calculation In C# Pin
Peter_in_278012-Sep-10 18:00
professionalPeter_in_278012-Sep-10 18:00 
GeneralRe: Time Difference Calculation In C# Pin
Sanket.Patil12-Sep-10 18:14
Sanket.Patil12-Sep-10 18:14 
GeneralRe: Time Difference Calculation In C# Pin
Peter_in_278012-Sep-10 18:22
professionalPeter_in_278012-Sep-10 18:22 
AnswerRe: Time Difference Calculation In C# Pin
Abhinav S12-Sep-10 18:25
Abhinav S12-Sep-10 18:25 
GeneralRe: Time Difference Calculation In C# Pin
Sanket.Patil12-Sep-10 19:33
Sanket.Patil12-Sep-10 19:33 
AnswerRe: Time Difference Calculation In C# Pin
Mycroft Holmes12-Sep-10 19:52
professionalMycroft Holmes12-Sep-10 19:52 
AnswerRe: Time Difference Calculation In C# Pin
J4amieC12-Sep-10 23:25
J4amieC12-Sep-10 23:25 
AnswerRe: Time Difference Calculation In C# Pin
Luc Pattyn13-Sep-10 2:36
sitebuilderLuc Pattyn13-Sep-10 2:36 
Hi,

there are only two cases that could work well:

1.
you have date AND time information, not just time. Then a TimeSpan calculated as the difference of two DateTime values is perfect.

2.
you only have time information, but you also know the context enforces something. In your case it would be: the time worked is anywhere between 0 and 24 hours. So, calculate the difference in any way you see fit (even with TimeSpan=DateTime-DateTime where both DateTimes have the same or no date), then enforce your boundary conditions: if the TimeSpan is less than zero, add 24 hours.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.


QuestionHow to represent this type of data in a c# app? Pin
stephen.darling12-Sep-10 11:37
stephen.darling12-Sep-10 11:37 
AnswerRe: How to represent this type of data in a c# app? Pin
Luc Pattyn12-Sep-10 11:57
sitebuilderLuc Pattyn12-Sep-10 11:57 
AnswerRe: How to represent this type of data in a c# app? Pin
Keith Barrow12-Sep-10 12:04
professionalKeith Barrow12-Sep-10 12:04 
AnswerRe: How to represent this type of data in a c# app? Pin
PIEBALDconsult12-Sep-10 12:36
mvePIEBALDconsult12-Sep-10 12:36 
GeneralRe: How to represent this type of data in a c# app? Pin
stephen.darling12-Sep-10 16:10
stephen.darling12-Sep-10 16:10 
GeneralRe: How to represent this type of data in a c# app? Pin
PIEBALDconsult12-Sep-10 16:22
mvePIEBALDconsult12-Sep-10 16:22 
QuestionTaking screenshots of PCs on LAN Pin
teknolog12312-Sep-10 8:50
teknolog12312-Sep-10 8:50 
AnswerRe: Taking screenshots of PCs on LAN Pin
OriginalGriff12-Sep-10 9:23
mveOriginalGriff12-Sep-10 9:23 
GeneralRe: Taking screenshots of PCs on LAN Pin
teknolog12312-Sep-10 9:29
teknolog12312-Sep-10 9:29 
GeneralRe: Taking screenshots of PCs on LAN Pin
OriginalGriff12-Sep-10 9:43
mveOriginalGriff12-Sep-10 9:43 
GeneralRe: Taking screenshots of PCs on LAN Pin
Eddy Vluggen12-Sep-10 9:53
professionalEddy Vluggen12-Sep-10 9:53 
AnswerRe: Taking screenshots of PCs on LAN Pin
Luc Pattyn12-Sep-10 9:53
sitebuilderLuc Pattyn12-Sep-10 9:53 
GeneralRe: Taking screenshots of PCs on LAN Pin
teknolog12312-Sep-10 10:04
teknolog12312-Sep-10 10:04 
GeneralRe: Taking screenshots of PCs on LAN Pin
Luc Pattyn12-Sep-10 10:12
sitebuilderLuc Pattyn12-Sep-10 10:12 
GeneralRe: Taking screenshots of PCs on LAN Pin
teknolog12312-Sep-10 10:15
teknolog12312-Sep-10 10:15 
GeneralRe: Taking screenshots of PCs on LAN Pin
Luc Pattyn12-Sep-10 10:18
sitebuilderLuc Pattyn12-Sep-10 10:18 
QuestionPainting on transparent background multiple times Pin
fdsfsa76f7sa612-Sep-10 1:47
fdsfsa76f7sa612-Sep-10 1:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.