如何获得秒表开始时间 [英] how to get stopwatch start time

查看:103
本文介绍了如何获得秒表开始时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
所有人都可以告诉我如何在asp.net中获取stopwatch.start()时间

提前感谢

解决方案

Stopwatch.Start()启动秒表。

要获得时间,您需要访问Elapsed属性。 Elapsed属性返回Timespan类型。您可以使用它来获取不同格式的值,即天,秒,毫秒。



秒表=  new 秒表(); 
watch.Start();
// 调用一些操作/方法
Timespan ts = watch.Elapsed;
int ms = ts.Seconds;





谢谢

- HTH

Nilesh


hi all can anyone please tell me how to get stopwatch.start() time in asp.net
thanks in advance

解决方案

Stopwatch.Start() starts the stopwatch.
To get the time elapsed you would need to access Elapsed property. Elapsed property returns the Timespan Type. Which you can use to get the value in different formats i.e. Days, Seconds, Milliseconds.

Stopwatch watch = new Stopwatch();
watch.Start();
//call some operation/method
Timespan ts = watch.Elapsed;
int ms = ts.Seconds;



Thanks
- HTH
Nilesh


这篇关于如何获得秒表开始时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆