如何在vb.net中验证日期 [英] how to validate date in vb.net

查看:81
本文介绍了如何在vb.net中验证日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我在项目中使用日期作为政策,其中开始日期是任何月份的第一天,结束日期将是开始日期的最后一天一个月的最后一天..政策将在一年后有效期为一年,政策应该更新。所以这个如何在日期进行验证..

如果你解决我将非常感谢这...



非常紧急所以请尽快给我答案..

我在等你的回答..





谢谢大家:-)



删除了紧迫性,因为我们回答了我们自己的个人时间[/编辑]

Hello,

I am using date for policy in my project where start date will be first day of any month and end date will be last day of start date month's last day..Policy will be valid for one year after one year policy should be get renewed.so for this how to do validation on date..
I'll be very much thankful if u resolve this ...

Its very urgent so please give me answer ASAP..
I'm waiting for ur answer..


Thank u folks :-)

Removed urgency because we answer on our own personal time [/Edit]

推荐答案

你究竟如何验证这一点真的取决于你:我们没有想法如何存储信息,或者需要在何处,甚至何时验证。



但是......解决这个问题非常简单:

假设您今天正在使用:

Exactly how you will validate this is really down to you: we have no idea how you are storing the info, or what needs verifying where, or even when.

But... working it out is pretty easy:
Assume you are working with today:
Dim today As DateTime = DateTime.Now.[Date]
Dim start As New DateTime(today.Year, today.Month, 1)
Dim [end] As DateTime = start.AddMonths(1).AddDays(-1)
Dim renew As DateTime = [end].AddYears(1)


你尝试了什么?你被困在哪里?你的代码在哪里?
What did you try? Where are you stuck? Where is your code?


这篇关于如何在vb.net中验证日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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