用户选择DOB时计算年龄 [英] calculate age when user selects DOB

查看:88
本文介绍了用户选择DOB时计算年龄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个下拉列表..在DDL1中我在DDL2中插入天数(31)我插入月份(直到12月),在DDL3中插入年份(从1985年到2000年)。假设用户选择日期,月份和年份,则会在下面的文本框中自动显示年龄。像1985年1月1日这样的年龄在文本框中显示为28年?我该怎么做 。

之前我使用过日历控件,但这并不成功。请指导我。谢谢。

I have 3 dropdownlists..In DDL1 i insert days(31) in DDL2 i insert months(till Dec) and in DDL3 i insert Years(from 1985 to 2000). suppose if user select date,month and year then automatically age in a below textbox appears. like for 1,Jan,1985 age appears in textbox as 28 years ? how can i do it .
Previously i used calendar control but that was not succesful. please guide me. Thanks.

推荐答案

试试这个插件。

http://www.datejs.com/ [ ^ ]



希望这有帮助
Try this plugin.
http://www.datejs.com/[^]

Hope this helps


这是从给定完整日期计算年龄的最佳示例。我认为它对你有帮助。



DateTime dob = new DateTime(1988,10,23);

TimeSpan tm =(DateTime。现在 - dob);

int age =(tm.Days / 365);
This one is the best example for calculate the age from given full date. I think its helping to you.

DateTime dob = new DateTime(1988, 10, 23);
TimeSpan tm = (DateTime.Now - dob);
int age = (tm.Days / 365);


这篇关于用户选择DOB时计算年龄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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