DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 23 Aug 2007 01:20:01 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Alhambra Eidos Kiquenet
          2    Hans Kesting


difference (in days) of two dates   
Hi, misters

which the best method for get the difference (in days) of two dates. The 
hour (hh:mm) don't mind, would be 00:00 for all dates.


1.)
    fechaUno.Substract(fechaDos).Days

2.)

 int desplazamientoFechaActual = fechaLaborable.DayOfYear -  
fechaActual.DayOfYear;

3.)      DateTime now = DateTime.Now;
     DateTime seed = Convert.ToDateTime("2006/01/01");

     TimeSpan diff = now - seed;
     int result = diff.TotalDays;

4.) Another ??

 Any help about it ? Thanks in advance. Greetings.

-- 
http://www.alhambra-eidos.es/web2005/index.html
www.kiquenet.net
www.trabajobasura.com/solusoft
Date:Thu, 23 Aug 2007 01:20:01 -0700   Author:  

Re: difference (in days) of two dates   

> Hi, misters
> 
> which the best method for get the difference (in days) of two dates.
> The hour (hh:mm) don't mind, would be 00:00 for all dates.
> 
> 1.)
> fechaUno.Substract(fechaDos).Days
> 2.)
> 
> int desplazamientoFechaActual = fechaLaborable.DayOfYear -
> fechaActual.DayOfYear;
> 
> 3.)      DateTime now = DateTime.Now;
> DateTime seed = Convert.ToDateTime("2006/01/01");
> TimeSpan diff = now - seed;
> int result = diff.TotalDays;
> 4.) Another ??
> 
> Any help about it ? Thanks in advance. Greetings.
> 


method 2 gives a wrong answer when the dates are in different years.
methods 1 & 3 return the same results (when you use the same dates)

Hans Kesting
Date:Thu, 23 Aug 2007 11:06:13 +0000 (UTC)   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us