473,383 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

date validation

hey friends can you give some example to validate date accepted by user in variable
as follows
int day;
int month;
int year;
It must validate entered details are correct or not ans
It must check that date is more than System date or not
Apr 12 '12 #1
6 3433
weaknessforcats
9,208 Expert Mod 8TB
Just write a date validation function. It would take 3 arguments and return true or false of the 3 arguments are a valid date or not.

Then write a date comparison function that takes 6 arguments and returns 0 if the two dates are equal, <0 of the first date is less than the secnd date and >0 of the first date is greater than the secnd date.

This is the same setup used by strcmp so everyone is used to seeing it.

I can help with your code but I can't provide it.
Apr 12 '12 #2
whodgson
542 512MB
"give some example to validate date accepted by user"... do you mean accepted or provided?
Take day... what integers would be valid for month of Jan?
Ans:>0 and <32. Write the algorithm then some code and show where your problems lie. Post it on this forum for help
Apr 20 '12 #3
Can you provide me code for date validation function and date comparison function??
Jan 29 '13 #4
Ex..
For Date Of Birth
Day : 29
Date : 2
Year :2014

Its invalid date..
Jan 29 '13 #5
Banfa
9,065 Expert Mod 8TB
We don't "provide" code, we will help if you have a problem with the code you have written. Consider these questions

1. What is the valid range of the year?
2. What is the valid range of the month?
3. What is the valid range of the day? Is it dependent on any other fields?
Jan 29 '13 #6
donbock
2,426 Expert 2GB
Also consider whether your application needs to work with a subset of valid dates. For example, a date-of-birth field might reject valid future dates and valid dates more than 120 years in the past.
Jan 29 '13 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

30
by: Dr John Stockton | last post by:
It has appeared that ancient sources give a method for Numeric Date Validation that involves numerous tests to determine month length; versions are often posted by incomers here. That sort of code...
14
by: Steve Wright | last post by:
I am trying to validate if an entry on a form is a date. I have adapted code I found here http://www.codingforums.com/archive/index.php/t-14325 as below but I can't seem the get the results that I...
11
by: Diego | last post by:
Hi all a quick question: how can I validate a date in asp.net (2.0) with c#? I didn't find a quick anwer. Thanks, Diego.
3
by: LDD | last post by:
Are there any built in time and/or date validation methods that one can make use of in .NET? thanks folks LDD
3
by: pmarisole | last post by:
The following javascript code gives me the date validation that I need except after the correct date is entered into the field, it puts the date in the wrong format EXAMPLE: User enters...
2
by: John Smith | last post by:
Hello, I have a VB.NET application with a Windows form that have several textboxes fields where I have dates entered. I would like to do a date validation check after the the field is updated, so...
1
by: jsredhar | last post by:
Dear Experts, I have two text boxes in my form (f1) i'm prompting the users to select the date from callender which is embeded within the from. when the users Pick the date from the calender.it...
8
pradeepjain
by: pradeepjain | last post by:
<script language = "Javascript"> /** * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/) */ // Declaring valid date character, minimum year and maximum...
5
Stang02GT
by: Stang02GT | last post by:
I have been asked to validate a date on our web-page so that people cannot enter dates like 14/1/08 or 2/30/06. I have found code that will do exactly what i need it to do, but i am not sure how to...
2
by: mshroom12 | last post by:
I am having trouble with the following project on hand. I use Eclipse to do my work in Java. This is what I'm supposed to complete. Date Validation In this exercise you will write a program...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.