如何计算两个texbox之间的总时间? [英] how to count total time between two texboxes?

查看:95
本文介绍了如何计算两个texbox之间的总时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi,当我单击总时间按钮时,如何从另一个文本框中的两个文本框中计算总时间??

示例:第一个文本框9:00 am第二个文本框11:00 am第三个文本框,当我单击按钮时应显示2hours.how to do this..any one help ??

hi how to calculate total time from two text boxes in another text box when i click total time button..?

example: 1st textbox 9:00am 2nd textbox 11:00am 3rd textbox when i click button should display 2hours.how to do this..any one help??

推荐答案

请参考这个....

http://stackoverflow.com/questions/4946316/showing-difference-在两个小时之间的时间值 [ ^ ]

http://stackoverflow.com/questions/11/how-do-i-calculate-相对时间 [ ^ ]

> http://www.techrepublic.com/article/calculate-period-of- net-time/5760752 [ ^ ]
please refer this....

http://stackoverflow.com/questions/4946316/showing-difference-between-two-datetime-values-in-hours[^]

http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time[^]

http://www.techrepublic.com/article/calculate-period-of-time-with-net/5760752[^]


DateTime startTime = DateTime.Now;

DateTime endTime = DateTime.Now.AddSeconds(75);

TimeSpan span = endTime.Subtract(startTime);
Console.WriteLine(时差(秒):" + span.Seconds);
Console.WriteLine(时差(分钟):" + span.Minutes);
Console.WriteLine(时差(小时):" + span.Hours);
Console.WriteLine(时差(天):" + span.Days);
DateTime startTime = DateTime.Now;

DateTime endTime = DateTime.Now.AddSeconds( 75 );

TimeSpan span = endTime.Subtract ( startTime );
Console.WriteLine( "Time Difference (seconds): " + span.Seconds );
Console.WriteLine( "Time Difference (minutes): " + span.Minutes );
Console.WriteLine( "Time Difference (hours): " + span.Hours );
Console.WriteLine( "Time Difference (days): " + span.Days );


这篇关于如何计算两个texbox之间的总时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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