Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 4:10 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Find a mans age from his personal ID number?
PostPosted: September 9th, 2006, 9:26 am 
Offline

Joined: November 12th, 2004, 3:28 pm
Posts: 34
Location: Akureyri Iceland
Hello

I am a driving instructor and I am running a web based training program for the theory test. It is built with Opus Pro XE 5, communicating via .asp to Access data base on the web. It is all running fine.

But my problem is that if the user is less than 18 years old his parents have to accept, and are responsible for paying for him. On the register page the user fills in a field with his personal ID number. This ID number then becomes his User name. This all works fine.

On the registration page there are also fields to fill in if the user is less than 18. But the teenagers very often do not fill them in!!

Now I need Opus to find out from the ID how old the person is and if the outcome is less than 18, then “if VAR PARENTS” is empty, you can go no further.

The ID number is built as follows: DDMMYYXXXX

My ID: 1509544879

150954=September 15th 1954
4879=Random ID

What I basically need is split the number into different variables, that I can use to compare to variables I get from the server time.

Hope someone can help

Jonas

_________________
Jonas Helgason
Menntaskolinn á Akureyri
Iceland


Top
 Profile  
 
 Post subject:
PostPosted: September 9th, 2006, 12:02 pm 
Offline

Joined: July 21st, 2005, 12:04 pm
Posts: 3
Hi Jonas,
on the input page, where the user fill-in the userid
can you split the field into separate fields, like DD MM YYY xxxx
and then concatenate them to make up the final id number?
You would then be able to use any of the sub-variables to run comparisons

Does this help?


Top
 Profile  
 
 Post subject:
PostPosted: September 11th, 2006, 11:36 am 
Offline

Joined: January 19th, 2005, 5:15 pm
Posts: 83
Location: Netherlands
If you can use opus-script, here's a method for calculating the age:

Code:
var birthDate = "120919826666";     // insert your userid here..

// Define current and birth dates
var cD       = new Date()            // current date
var bday    = birthDate.substring(0,2)   // get the day from string
var bmonth    = birthDate.substring(2,4)   // get the month from string
var byear    = birthDate.substring(4,8)   // get the year from string

// Get difference from current date (cD) and birthdate. Age = var age
var age      = cD.getFullYear() - byear;
if( cD.getMonth() < (bmonth-1) )                  age--;
if( cD.getMonth() == (bmonth-1) && cD.getDate() < bday)   age--;

if( age < 18) var PARENTS = true;


Hope this helps..

Remy.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 42 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group