home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Du Jour
/
SoftwareDuJour.iso
/
BUSINESS
/
DBASE
/
DBAPG.ARC
/
DATETEST.PRG
< prev
next >
Wrap
Text File
|
1984-08-12
|
1KB
|
46 lines
* Program.: DATETEST.PRG
* Author..: Luis A. Castro
* Date....: 8/2/83, 11/20/83, 01/19/84
* Notice..: Copyright 1983 & 1984, Ashton-Tate, All Rights Reserved
* Version.: dBASE II, version 2.4x
* Notes...: Subroutine to verify a date.
* Local...: t:month, t:day, t:year
*
* IN: mdate-C-8 Calendar date, assumed to be in
* or mdate-C-10. MM/DD/YY or MM/DD/YYYY format.
*
* OUT: is:error-L-1. Validation flag
*
STORE T TO is:error
STORE TRIM(mdate) TO mdate
IF ( LEN(mdate) <> 8 .AND. LEN(mdate) <> 10 ) .OR.;
" "$mdate .OR. "-"$mdate .OR. "."$mdate .OR. "+"$mdate
* ---Must not contain special characters.
RETURN
ENDIF
*
STORE VAL( $(mdate,1,2) ) TO t:month
STORE VAL( $(mdate,4,2) ) TO t:day
STORE VAL( $(mdate,7,LEN(mdate) - 6) ) TO t:year
*
DO CASE
CASE t:month < 1 .OR. t:month > 12 .OR. t:day < 1 .OR.;
t:day > VAL( $("00312931303130313130313031",;
( t:month - 13*INT(t:month/13) ) * 2 + 1, 2 ) )
*
CASE LEN(mdate)= 8 .AND. t:month=2 .AND.;
t:day > 28 .AND. t:year/4 > INT(t:year/4)
*
CASE LEN(mdate)=10 .AND. t:month=2 .AND.;
t:day > 28 .AND. ( (t:year/4 > INT(t:year/4) .AND.;
t:year/100 = INT(t:year/100)) .OR.;
t:year/400 > INT(t:year/400) )
*
OTHERWISE
STORE F TO is:error
ENDCASE
*
RELEASE t:month, t:day, t:year
RETURN
* EOF: DATETEST.PRG