Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > .NET Framework 1.x
|
.NET Framework 1.x For discussing versions 1.0 and 1.1 of the Microsoft .NET Framework.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 1.x section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 7th, 2006, 09:23 AM
Registered User
 
Join Date: Nov 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default DateDiff(Hour, 1stDate, 2ndDate) , Very Urgent

Hi All,

I am using ASP.net 1.1 with C#, Problem is that i have two text box for two Date (Date with Time ) input and one button. OnClick button want difference no of Hours between two input Date&Time.

Its very urgent, Help Me.
Regards,
NAX111

 
Old March 22nd, 2007, 08:58 AM
Authorized User
 
Join Date: Mar 2007
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Take this.........
    DateTime dt1 = Convert.ToDateTime("2/25/2007 01:00:00 PM");
    DateTime dt2 = Convert.ToDateTime("2/23/2007 01:00:00 AM");
       label1.Text = "2/25/2007 01:00:00 PM";
       label2.Text = "2/23/2007 01:00:00 AM";
    TimeSpan ts = dt1 - dt2;
       MessageBox.Show("value of ts = "+ts);

 
Old March 24th, 2007, 02:02 PM
Authorized User
 
Join Date: Feb 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi ,

u can use this.

dt1=convert.todatetime(textbox1.text)
dt2=convert.todatetime(textbox2.text)

datediff(dateinterval.hour,dt2,dt1)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Hour glass cursor qadeer05 Javascript 9 August 7th, 2009 10:36 PM
Hour by Hour Matrix Report Ed_Conde BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 0 August 12th, 2008 02:51 PM
need realtime clock to chime on hour The Wizard JSP Basics 2 January 23rd, 2007 07:50 PM
Timesheet hour value problem geoffers BOOK: Beginning VB.NET Databases 5 August 24th, 2005 04:30 AM
Using Datepart to get half an hour precision venomm Access 2 March 16th, 2005 10:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.