Find date diiference
-
Hi all, can any please tell me how to find difference between two dates in a web application using Vb.net. I used diff1 = (CDate(day2).Subtract(CDate(day1)).TotalHours) Label11.Text = diff2 & "hrs" diff3 = (CDate(day3).Subtract(CDate(day2)).TotalHours) Label12.Text = diff3 & "hrs" Its working fine in the Local system without any conversion problems,but in a intranet its showing error Conversion from string "13/04/2006 4:11:50 PM" to type 'Date' is not valid. please give me suggestions Thanks in Advance Bino Varghese
-
Hi all, can any please tell me how to find difference between two dates in a web application using Vb.net. I used diff1 = (CDate(day2).Subtract(CDate(day1)).TotalHours) Label11.Text = diff2 & "hrs" diff3 = (CDate(day3).Subtract(CDate(day2)).TotalHours) Label12.Text = diff3 & "hrs" Its working fine in the Local system without any conversion problems,but in a intranet its showing error Conversion from string "13/04/2006 4:11:50 PM" to type 'Date' is not valid. please give me suggestions Thanks in Advance Bino Varghese
Hi I would suggest looking at the date settings on the server, make sure that its set to the same date format as you are wanting to use. As an aside take a look at the
DateDiff
function http://msdn2.microsoft.com/en-us/library/b5xbyt6f(VS.80).aspx[^] Which will provide a much simpler implementation of your code. -
Hi I would suggest looking at the date settings on the server, make sure that its set to the same date format as you are wanting to use. As an aside take a look at the
DateDiff
function http://msdn2.microsoft.com/en-us/library/b5xbyt6f(VS.80).aspx[^] Which will provide a much simpler implementation of your code.