i have this code
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="test1.aspx.vb" Inherits="gfln1.test1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> </head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/ui.all.css" rel="stylesheet" type="text/css" /> <script src="http://projectcodegen.com/jquery.ui.datetimepicker.js" type="text/javascript"></script> </head> <script type="text/javascript"> $(function() { $('#TextBox1').datetimepicker(); $('#TextBox2').datetimepicker();
}); </script> <body> <form id="form1" runat="server"> <div>
Enter Start Date/Time<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> Enter End Date/Time<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> Enter Conference days<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> <br /> <asp:Button ID="Button1" runat="server" Text="Calculate Hours For businees" />
</div> </form> </body> </html>
|
i want that if i click on button it gives me time differnce b/w just two time not date time
for example
if textbox1 contain "12/24/2010 07:11 PM"
and textbox2 contain "12/25/2010 08:11 AM"
and i want to calcaute just difference in hr b/w two time ,not datetime then i have
t1 = Convert.ToDateTime(Me.TextBox1.Text).ToLongTimeString()
t2 = Convert.ToDateTime(Me.TextBox2.Text).ToLongTimeString()
Dim tsdiff As TimeSpan = t2.Subtract(t1)
it should give 13 hours but right now its giving me -11 hours , can any oen help me