473,808 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validating Birth date and calculating it into a single digit

1 New Member
Hey!
So i have a program i need to write that must include the user to input their birthdate (mm-dd-yyyy) . Then i must validate the input from the user, meaning i need to check to make sure the month is between 1 and 12, the day is appropriate for the month, and the year is between 1875 and 2199. Then after that i need to calculate a single digit from the birth date. For example if your birth date is 3-19-1955 you add 3+1+9+1+9+5+5 to get 33. Then i would have to break this apart again and add 3+3 to get 6.
Any ideas on how i would do that ?
Oct 20 '07 #1
1 2675
Meetee
931 Recognized Expert Moderator Contributor
Hey!
So i have a program i need to write that must include the user to input their birthdate (mm-dd-yyyy) . Then i must validate the input from the user, meaning i need to check to make sure the month is between 1 and 12, the day is appropriate for the month, and the year is between 1875 and 2199. Then after that i need to calculate a single digit from the birth date. For example if your birth date is 3-19-1955 you add 3+1+9+1+9+5+5 to get 33. Then i would have to break this apart again and add 3+3 to get 6.
Any ideas on how i would do that ?
You have the whole idea. Do you need more? Anyways, you can tajke input from user in the form of string and take first two digit (until "-" comes) Thenvalidate it between 1-12. Same is applicable for date and year. Actually I cannot post the code here as per posting guidelines. Please paste here what you have done so far, so that I can help you by seeing your code.

Regards
Oct 20 '07 #2

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

Similar topics

13
3936
by: David Gray | last post by:
Greetings all, Quick newbie type question: I would like to be able to trap non-numerical data entered into a textbox via CTRL+C and/or Shift+Insert. I realise that this data can be validated using the TEXTn_validate event but I would like to stop the user before it gets that far.
20
11865
by: Gav | last post by:
I have a database with date of births stored dd/mm/yyyy (english dating system) and =date() returns a date in the same format in my server. how do i find the persons age using these two pieces of date. thanks gavin
6
4085
by: un[real] | last post by:
Like I said in the title, I have to calculate the sum of the numbers of an interger with a recursive fonction. Exemple: n=1255, sum= 1 + 2 + 5 + 5= 13 Do I have to use a string on can I use a simple cin ?? Thanks for your help !! And sorry for my english :)
1
2908
by: panche | last post by:
I'm developing a fairly simple user control that has two textboxes for date/time entry (a from date/time and a to date/time). One of my requirements is that there should be no button that sets these values (i.e., no button to cause a postback). The problem I'm having is that I need a number of validations to be performed on the data entry, but I don't know how to do this without having the user control/page posted back to the server. ...
7
3075
by: Middletree | last post by:
I am trying to display dates in a spreadsheet, but the dates need to be in a format that will allow them to be sorted in Excel. The datatype in the SQL Server database is datetime. In this case, I need to display the date only, not the time. But I don't want to change the datatype in the database because the time is used in other places. So what I am doing is pulling it out of the database, then modifying it in ASP/VBScript by using the...
232
13384
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first set of examples, after decoding the HTML FORM contents, merely verifies the text within a field to make sure it is a valid representation of an integer, without any junk thrown in, i.e. it must satisfy the regular expression: ^ *?+ *$ If the...
7
2145
by: laredotornado | last post by:
Hi, Does anyone have a cross-browser JS function that validates a US phone number? I consider the following to be valid phone number formats: var p = "5558675309"; var p = "(312) 123-4567"; var p = "512-234-5678"; Thanks, - Dave
3
2323
by: psminn | last post by:
Hi, I searched first, but couldn't find an answer. I'm using Access 2003. When entering the date of birth of some of our participants, when I type 1927 it automatically changes to 2027. This only happens for dates under 1930. Any help, links, etc? Thanks, Pam
6
4510
by: Richard | last post by:
I'm validating a date and time string which must be EXACTLY of the format yy-mm-dd hh:mm:ss and extracting the six numeric values using sscanf. I'm using the format string "%2u-%2u-%2u %2u:%2u:%2u" which works, but it allows each numeric field to be either 1 or 2 digits in length. Also the man page for sscanf says that preceeding white space before a numeric is ignored.
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9195
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5547
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.