给我解决方案 [英] Give me solution

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

问题描述

txtAge.Text = DateTime.Now.Year-Convert.ToDateTime(txtdate.Text).Year;

这里的"Datetime"给出错误..
谁能解决这个问题...

txtAge.Text = DateTime.Now.Year - Convert.ToDateTime(txtdate.Text).Year;

Here "Datetime" giving error..
Can any one solve this please...

推荐答案

给我钱.

要求答案将使您发脾气和嘲弄,仅此而已.
Give me money.

Demanding an answer will get you sarcasm and derision, nothing more.


首先,标题不太清楚您真正要问的问题.

其次,考虑在将txtAge的Text属性放入字符串之前,将日期转换为字符串.

第三,您应该使用DateDiff函数确定日期?几个月?年?在两个日期之间.

例如:
First of all the title isn''t very clear of what you really want to ask.

Second, consider casting your date to a string before putting in the Text property of txtAge.

Third, you should use the DateDiff function to determine the days? months? years? between the two dates.

example:
System.TimeSpan diffResult = DateTime.Now.Subtract( Convert.ToDateTime(txtdate.Text));

txtAge.Text = diffResult.Years.ToString();



祝你好运!



Good luck!


这篇关于给我解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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