申请人的年龄检查 [英] Age check for an applicant

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

问题描述

我正在提出一项申请,申请人只有在他/她小于或等于23岁时才能填写表格,如1月1日和7月1日

我已经完成基本年龄检查,但我如何在其中纳入日期标准???

请帮助。

解决方案

尝试此方法。可能你需要微调它。



 DateTime dob =  new  DateTime( 2001  12  12  ); 
DateTime cutOffDate = new DateTime(DateTime.Now.Year, 1 31 );
TimeSpan sp = new TimeSpan(dob.Ticks);
DateTime d = cutOffDate.Subtract(sp);

// d。截至今年1月1日,年份应小于23


I am making an application in which an applicant can fill in a form only if he/she is less than or equal to 23 years of age as on 1st Jan and 1st July
I have done the basic age check but how do i incorporate the date criteria in it???
Please Help.

解决方案

Try this method. Might be you have to fine tune it.

DateTime dob = new DateTime(2001, 12, 12);
DateTime cutOffDate = new DateTime(DateTime.Now.Year, 1, 31);
TimeSpan sp = new TimeSpan(dob.Ticks);
DateTime d = cutOffDate.Subtract(sp);
 
//d.Year should be less than 23 as of 1st of Jan in current year.


这篇关于申请人的年龄检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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