Click here to Skip to main content
15,885,182 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: How Do I Print a file with Epson T88IV quickly? Pin
Aman Bhullar18-Jun-09 2:42
Aman Bhullar18-Jun-09 2:42 
GeneralRe: How Do I Print a file with Epson T88IV quickly? Pin
Member 239059518-Jun-09 22:49
Member 239059518-Jun-09 22:49 
GeneralRe: How Do I Print a file with Epson T88IV quickly? Pin
Aman Bhullar19-Jun-09 6:18
Aman Bhullar19-Jun-09 6:18 
Question.Net Date Compare Pin
Tristan Rhodes17-Jun-09 3:28
Tristan Rhodes17-Jun-09 3:28 
AnswerRe: .Net Date Compare Pin
Luc Pattyn17-Jun-09 3:39
sitebuilderLuc Pattyn17-Jun-09 3:39 
GeneralRe: .Net Date Compare Pin
Baran M17-Jun-09 3:50
Baran M17-Jun-09 3:50 
GeneralRe: .Net Date Compare Pin
Tristan Rhodes17-Jun-09 10:40
Tristan Rhodes17-Jun-09 10:40 
GeneralRe: .Net Date Compare Pin
Luc Pattyn17-Jun-09 10:48
sitebuilderLuc Pattyn17-Jun-09 10:48 
Hi,

it all depends on what you want exactly.

1.
if parts of the DateTime should be identical, then check those parts, as in:
DateTime dt1=...;
DateTime dt2=...;
if (dt1.Date==dt2.Date && dt1.Hours==dt2.Hours) isSufficientlyEqual();


the problem now is that 16:59:59 would equal to 16:00:00 and not to 17:00:00 which is much closer!

2.
if time distance is important, calculate it
DateTime dt1=...;
DateTime dt2=...;
if (dt1.Date==dt2.Date) {
    float seconds=dt1.Subtract(dt2).TotalSeconds;
    if (seconds>-100 && seconds<100) isSufficientlyClose();
}


3.
Up to the second equal:
DateTime dt1=...;
DateTime dt2=...;
if (dt1.AddMilliseconds(-dt1.MilliSeconds)==dt2.AddMilliseconds(-dt2.MilliSeconds)) {
    isPrettyClose();
}




Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.

GeneralRe: .Net Date Compare - Code Clean Up, Use an Extension Method for DateTime Pin
ProtoBytes17-Jun-09 12:23
ProtoBytes17-Jun-09 12:23 
GeneralRe: .Net Date Compare - Code Clean Up, Use an Extension Method for DateTime Pin
Tristan Rhodes17-Jun-09 22:51
Tristan Rhodes17-Jun-09 22:51 
GeneralRe: .Net Date Compare Pin
Tristan Rhodes17-Jun-09 22:53
Tristan Rhodes17-Jun-09 22:53 
AnswerRe: .Net Date Compare Pin
David Skelly17-Jun-09 22:20
David Skelly17-Jun-09 22:20 
GeneralRe: .Net Date Compare Pin
Tristan Rhodes17-Jun-09 22:56
Tristan Rhodes17-Jun-09 22:56 
GeneralRe: .Net Date Compare Pin
David Skelly18-Jun-09 4:42
David Skelly18-Jun-09 4:42 
AnswerRe: .Net Date Compare Pin
PIEBALDconsult18-Jun-09 6:19
mvePIEBALDconsult18-Jun-09 6:19 
GeneralRe: .Net Date Compare Pin
Luc Pattyn19-Jun-09 4:25
sitebuilderLuc Pattyn19-Jun-09 4:25 
GeneralRe: .Net Date Compare Pin
PIEBALDconsult19-Jun-09 4:55
mvePIEBALDconsult19-Jun-09 4:55 
QuestionShut Down Local Computer Using VB.NET Pin
shinoopmathew16-Jun-09 22:59
shinoopmathew16-Jun-09 22:59 
AnswerRe: Shut Down Local Computer Using VB.NET Pin
Henry Minute16-Jun-09 23:11
Henry Minute16-Jun-09 23:11 
AnswerRe: Shut Down Local Computer Using VB.NET Pin
Vasudevan Deepak Kumar17-Jun-09 1:36
Vasudevan Deepak Kumar17-Jun-09 1:36 
AnswerRe: Shut Down Local Computer Using VB.NET Pin
K030617-Jun-09 2:45
K030617-Jun-09 2:45 
AnswerRe: Shut Down Local Computer Using VB.NET Pin
krunal2521-Dec-09 18:41
krunal2521-Dec-09 18:41 
QuestionExport to excel is not working on deploying server Pin
binod kumar16-Jun-09 20:52
binod kumar16-Jun-09 20:52 
AnswerCross Post! Pin
Henry Minute16-Jun-09 23:08
Henry Minute16-Jun-09 23:08 
Questionhow to open a word document? Pin
kvalli16-Jun-09 20:30
kvalli16-Jun-09 20:30 

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.