本文介绍了如何在C#Winforms中获得登录时间和注销时间之间的差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
请帮帮我,
如何获得用户登录和注销时间的差异并将其显示在其他文本框中?

事情是登录时间应该在我们单击按钮登录时自动加载到文本框中,然后在那一刻我们单击按钮注销时自动加载.我希望当前时间加载到注销文本框中,并且希望差异显示在其他文本框中.... .

hi All ,
Please help me out,
how to get difference of user login and logout time and show it in some other textbox?

the thing is login time should automatically load in the textbox when we click on button login and later when we click on button logout at that moment I want current time to be loaded in logout textbox and difference to be displayed in other textbox.....

推荐答案

DateTime loginDate = new DateTime();
double  sessionHours = (DateTime.Now - loginDate).TotalHours;


您可以检查其他可以检索的数据,例如天,分钟,秒等.

希望我能帮上忙


You can check the other data you can retrieve like days , minutes , seconds and etc

Hope i could help


这篇关于如何在C#Winforms中获得登录时间和注销时间之间的差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 00:46