This is part of a stored procedure and returns a text such as 30 years, 10 
months. You can adapt the code to your needs.

IF (.pbirthdate IS NULL) THEN
  RETURN ''
ENDIF
SET VAR spvdate1 DATE = .pbirthdate
SET VAR spvdate2 DATE = .#DATE
SET VAR spvyrdiff INTEGER = +
( (INT(FORMAT(.spvdate2,'yyyy'))) - +
(INT(FORMAT(.spvdate1,'yyyy'))) )
SET VAR spvmodiff INTEGER = +
( (INT(FORMAT(.spvdate2,'mm'))) - +
(INT(FORMAT(.spvdate1,'mm'))) )
IF spvmodiff < 0 THEN
  SET VAR spvmodiff = (.spvmodiff + 12)
  SET VAR spvyrdiff = (.spvyrdiff - 1)
ENDIF
SET VAR spvtage TEXT = +
(CTXT(.spvyrdiff) & 'Years,' & CTXT(.spvmodiff) & 'Months')
RETURN .spvtage

----- Original Message -----
From: "Gray, Damon" 
Date: Friday, November 7, 2008 10:34 am
Subject: [RBASE-L] - Calculating a persons age.
To: [email protected] (RBASE-L Mailing List)

> In the absence of a DATEDIFF function, is there a function in 
> RBase 6.5++
> that will allow me to calculate an employee's age from their 
> date of birth
> and .#DATE, or do I need to code this up?
> 
> 
> 
> 
> 
> Damon J. Gray
> 
> Business System Services
> 
> Anvil Corporation
> 
> (360) 937-0770
> 
> 
> 
> 

--- RBASE-L
================================================
TO POST A MESSAGE TO ALL MEMBERS:
Send a plain text email to [email protected]

(Don't use any of these words as your Subject:
INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: INTRO
================================================
TO UNSUBSCRIBE: 
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: UNSUBSCRIBE
================================================
TO SEARCH ARCHIVES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: SEARCH-n
(where n is the number of days). In the message body, 
place any 
text to search for.
================================================


Reply via email to