Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


From Date To Date Return Total Hours ASP.NET FORM

From Date To Date Return Total Hours ASP.NET FORM

From Date To Date Return Total Hours ASP.NET FORM

Below is my code and it simply renders 2 textboxes and a button. The first textbox value will be "FROM DATE" and the second textbox value will be "TO DATE". The database table has a column for Hours and a Column for Date. When the end user submits their entry, I would like to return the total hours between the two dates provided. I'm having trouble researching this scenario as it appears to be more complex than I imagined it would be, any help would be gratefully appreciated!



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>

$(function() {
$( "#datepicker" ).datepicker();

$(function () {

<form id="form1" runat="server">
<asp:TextBox ID="datepicker" runat="server"></asp:TextBox>
<p>To <asp:TextBox ID="datepicker2" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />


RE: From Date To Date Return Total Hours ASP.NET FORM

I have excatly the same situation on a time sheet entry site, what I did is created an SQL function that calculates the differential and give the result on the post back. The SQL is very easy to write using the DATEDIFF() function

RE: From Date To Date Return Total Hours ASP.NET FORM

Can you give an example using my layout or any example at all with code behind?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close