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
Sam HobbsPosted Dec 25, 2010, 5:57 PM
erum mirzaPosted Dec 25, 2010, 7:32 AM
for example conference go for 2 days say 25 dec and 26 dec ,now for time it should be 12 hours daily on both days ,for example time may be 5:00pm to 5 :am means 12 hours
that means conference will go 12 hours daily ,i need to so this
I hope u got my oint
Suthish NairPosted Dec 25, 2010, 1:49 AM
erum mirzaPosted Dec 24, 2010, 9:09 PM
Sam HobbsPosted Dec 24, 2010, 5:44 PM
Don't call ToLongTimeString and make t1 and t2 DateTime objects instead of string objects. Note that I would post my code that I tested and that works the way you expect it to but my code is in C#.