5
Answers

Date query?

Photo of Santhosh K S

Santhosh K S

12y
1.1k
1
Hi........

  I have two date startdate 05/14/2012  12:25:00 and enddate 05/15/2012 23:21:00 like this ,
i need diffrence of this time in terms of  HH:MM:SS  Please suggest.......................

Thanks in advance

Answers (5)

0
Photo of Senthilkumar
NA 15.2k 2.4m 12y
Hi,

when you compare the date time, always you need to ensure that you are checking the date time format in equally. Otherwise you need to convert into common format which will solve your business requirement.


Accepted
0
Photo of brunda k
NA 1.5k 11.9k 12y
convert(smalldatetime,'03/30/2012 22:40:00')

http://msdn.microsoft.com/en-us/library/ms187928.aspx

Accepted
0
Photo of Kunal Vaishya
NA 4.1k 266.1k 12y


Dear first

try
1955-12-13 12:43:10 Format to convert small date time

Date=convert(smalldatetime, '2012-12-13 22:40:00')

let me know tit work or not





 
Accepted
0
Photo of sathish kumar
NA 119 114.9k 12y


                                                  yr   D   m Hr  Min   Sec
DateTime startDate= new DateTime(2005 ,2 ,1 ,3, 4 ,    56);


DateTime EndDate= new DateTime(2008,2,1,3,4,12);

TimeSpan DiffDate= EndDate.Subtract(StartDate)

console.writline(DiffDate.Days.Tostring() + "Days"); ---DateWise Diff


console.writline(DiffDate.Hours.Tostring() + "Hours");

console.writline(DiffDate.Minutes.Tostring() + "Minutes");


Tryout this....




0
Photo of Vulpes
NA 98.3k 1.5m 12y
Does it work if you re-express the date in this format?

 '2012-03-30 22:40:00'