.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Sqlserver time

Posted By: Naresh     Posted Date: August 19, 2010    Points:2   Category :ASP.Net
Hi All,


If i give databse columns value as (12:00-19:00) i.e time,can we able to get start time,endtime and difference in FRONTEND AND also in backend.Here 12:00 is the starttime and 19:00 is the endtime.Tell me how we can acheive this in front end and also in backend.


Responses
Author: Syed Shakeer Hussain             
Posted Date: August 19, 2010     Points: 5   

Hi,
The Below code is to find the Difference between two Times

DateTime StartTime = DateTime.Now.ToLocalTime();

DateTime EndTime = DateTime.Now.ToLocalTime();

string dt = EndTime.Subtract(StartTime).ToString().Split('.')[0].ToString();

button1.Text = dt;


OutPut:

StartTime:8/7/2010 3:31:16 PM

EndTime:8/7/2010 3:32:07 PM

dt=00:00:50




Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend