codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  finding difference betwee two dates  Archive Import (mdfaizan) at 17:28 on Saturday, July 12, 2003
 

i want know how to find the difference between two date which contains time also in hours and minutes(hrours:minutes)

  Re: finding difference betwee two dates  Troy Wolf at 13:01 on Tuesday, July 15, 2003
 

Your post is in the Java forum, and I don`t know Java, but you can use SQL Server if this is available to your program.

DATEDIFF ( datepart , startdate , enddate )

Datepart Abbreviations
-----------------------
Year yy, yyyy
quarter qq, q
Month mm, m
dayofyear dy, y
Day dd, d
Week wk, ww
Hour hh
minute mi, n
second ss, s
millisecond ms
---------------------
For example, this query below will give you the number of minutes between the 2 date/time values.

select DATEDIFF(mi,`07/01/2003 15:00`,`07/15/2003 08:32`)
Troy Wolf: site expert
Shiny Solutions


  Re: finding difference betwee two dates  Archive Import (Narendra Lahoti) at 07:56 on Thursday, August 07, 2003
 

Hi,
this might help you.



Calendar Calendar_1=Calendar.getInstance();
Calendar Calendar_2 =Calendar.getInstance();
Calendar_1.set(1900+70,1,1,0,0,0);
Calendar_2.set(1900+70,1,1,1,1,1);
Date Date_1 = Calendar_1.getTime();
Date Date_2 = Calendar_2.getTime();
long long_diff = (Date_2.getTime() - Date_1.getTime())/1000;

System.out.println("Difference in seconds = "+long_diff);





  Re: finding difference between two dates  djladerasc at 01:51 on Tuesday, February 24, 2004
 

Hi! How 'bout the difference of dates in terms of 'days'. Please reply, thanks!








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Data
•  sort with javascript
•  setting default frame for an ASP.net app
•  Password creation and password protected site
•  Script For Customers To Upload Images To My Server
•  next and previous buttons
•  Re: C# and EXCEL question saving a file saving the the first column as read only
•  Windows Authentication using LDAP get user first name
•  Javabeans incorporating sql query.


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005