PC Review


Reply
Thread Tools Rate Thread

day-difference between 2 datetimes

 
 
Daves
Guest
Posts: n/a
 
      15th Sep 2006
hi,
how do I get the difference, in days, between two DateTime classes?


 
Reply With Quote
 
 
 
 
=?ISO-8859-2?Q?Marcin_Grz=EAbski?=
Guest
Posts: n/a
 
      15th Sep 2006
Hi Daves,

Daves napisał(a):
> hi,
> how do I get the difference, in days, between two DateTime classes?


You'll need the TimeSpan.TotalDays.

sample:
TimeSpan ts=dateTime2.Subtract(dateTime1);
double daysDifference=ts.TotalDays.

With regards
Marcin
 
Reply With Quote
 
Daves
Guest
Posts: n/a
 
      15th Sep 2006
thx, exactly what was needed
"Marcin Grzębski" <(E-Mail Removed)> wrote in message
news:eedvc7$gi0$(E-Mail Removed)...
> Hi Daves,
>
> Daves napisał(a):
>> hi,
>> how do I get the difference, in days, between two DateTime classes?

>
> You'll need the TimeSpan.TotalDays.
>
> sample:
> TimeSpan ts=dateTime2.Subtract(dateTime1);
> double daysDifference=ts.TotalDays.
>
> With regards
> Marcin



 
Reply With Quote
 
Christof Nordiek
Guest
Posts: n/a
 
      15th Sep 2006
Hi,

instead of
ts = dateTime2.Subtract(dateTime1);

you als could say

ts = dateTime2 - dateTime1;

"Marcin Grzębski" <(E-Mail Removed)> schrieb im Newsbeitrag
news:eedvc7$gi0$(E-Mail Removed)...
> Hi Daves,
>
> Daves napisał(a):
>> hi,
>> how do I get the difference, in days, between two DateTime classes?

>
> You'll need the TimeSpan.TotalDays.
>
> sample:
> TimeSpan ts=dateTime2.Subtract(dateTime1);
> double daysDifference=ts.TotalDays.
>
> With regards
> Marcin



 
Reply With Quote
 
=?ISO-8859-2?Q?Marcin_Grz=EAbski?=
Guest
Posts: n/a
 
      15th Sep 2006
Hi Christof,

You're right.
But i'll trying not using the class operators (overload),
since i leave C++ for Java.
:-)

Cheers!
Marcin

Christof Nordiek napisał(a):
> Hi,
>
> instead of
> ts = dateTime2.Subtract(dateTime1);
>
> you als could say
>
> ts = dateTime2 - dateTime1;
>
> "Marcin Grzębski" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:eedvc7$gi0$(E-Mail Removed)...
>> Hi Daves,
>>
>> Daves napisał(a):
>>> hi,
>>> how do I get the difference, in days, between two DateTime classes?

>> You'll need the TimeSpan.TotalDays.
>>
>> sample:
>> TimeSpan ts=dateTime2.Subtract(dateTime1);
>> double daysDifference=ts.TotalDays.
>>
>> With regards
>> Marcin

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between two datetimes Sheldon Microsoft VB .NET 2 10th Nov 2008 01:01 PM
Best way for compare Nullable Datetimes Alhambra Eidos Kiquenet Microsoft ASP .NET 0 7th Feb 2008 10:34 AM
dates, times & datetimes SteveH Microsoft Access 1 27th Aug 2004 09:19 AM
VS.NET and DateTimes? Bug in VS.NET? Siegfried Heintze Microsoft ADO .NET 3 17th Mar 2004 08:01 AM
Problem with datetimes in SQL CE.Need help. jorgeo Microsoft Dot NET Compact Framework 4 1st Aug 2003 08:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:03 AM.