.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 >> Windows Application >> Post New QuestionBookmark and Share Subscribe to Forum

display dynamic time

Posted By: Madhu Gowda     Posted Date: February 21, 2011    Points:2   Category :Windows Application
Hi,
I thought to make code for an application which should display duration between current time and system login time.
i been confused to above coding part.
plz guide me

Thanx in advance.

Responses
Author: Jayakumar             
Posted Date: February 21, 2011     Points: 5   

hi

this is current time Your System time below code

datetime.now

Regards
Name : R.Jayakumar(JK)
Email Id : kumaraspcode2009@gmail.com
Author: Sunil Yadav       [Moderator]   Accepted Answer   
Posted Date: February 21, 2011     Points: 10   

Hi,

You can store login time of the user in a global variable and then calculate duration between them.

To display dynamic time, you can use Timer Control.

Drag and Drop Timer control and on Tick event write the following code.

For ex :
 private void timer1_Tick(object sender, EventArgs e)
{
DateTime loginTime = loginTime;//First login time

TimeSpan span = DateTime.Now.Subtract(loginTime);

Console.WriteLine(span.Hours);

//Sililarly you can find Minutes,Seconds,days
}




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