|
i want know how to find the difference between two date which contains time also in hours and minutes(hrours:minutes)
|
|
|
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`)
|
|
|
|
|
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);
|
|
|
Hi! How 'bout the difference of dates in terms of 'days'. Please reply, thanks!
|
|
|
|
|
|
|
|