关于Asp.net4.0的问题 [英] Question regarding Asp.net4.0

查看:80
本文介绍了关于Asp.net4.0的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从两个文本框中取消时间并存储到asp.net中的另一个文本框中.

how to substrat time from two textboxes and store into another textbox in asp.net

推荐答案

您可以使用TimeSpan.

这是该示例
You can use TimeSpan.

Here are example for that
DateTime dt1= DateTime.Now; // select Date 1
DateTime dt2= DateTime.Now.AddDays(20);  // select Date 2


TimeSpan ts = dt2 - dt1; // Substract Date 2 to Date 1

Textbox1.Text= ts.Days; // Get The Total Days Difference


在这里,它给出了20天不同的时间


Here it gives 20 for days different


这篇关于关于Asp.net4.0的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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