Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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 :-)

[Edit] Removed urgency because we answer on our own personal time [/Edit]
Posted
Updated 25-Feb-14 0:27am
v3

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:
VB
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)
 
Share this answer
 
Comments
Varsha Bhosle 25-Feb-14 6:47am    
Thanks a lot :-)

Actually I m importing data from ms access database to ms sql server 2005 ,its having field as InsuranceStartDate and InsuranceEndDate so i want to validate this ..
OriginalGriff 25-Feb-14 7:18am    
So read the value from Access into a DateTime.
Use the Date property to remove any time info - it resets to midnight.
Then create what you think the values should be (start, end, renew) using the above and compare them against the Access DB values.
What did you try? Where are you stuck? Where is your code?
 
Share this answer
 
Comments
Varsha Bhosle 25-Feb-14 6:31am    
I did not try anything i want logic behind this to achieve it..
udaybhaskars 27-Feb-14 1:30am    
hi phil.o,

This is not a solution add it in comments, don't add solution just for points. Please try to add proper solutions otherwise its waste of time for the users who are searching for the same question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900