Syntax
short CheckDate(
struct date_struct *datep
);
Parameters
- datep
- [in] Pointer to the date_struct structure that is to be checked.
Return value
Returns OK if the date is valid, ERROR otherwise.
Remarks
Checks if the date structure passed to the function holds a valid date.For instance, if you specify a date of 29 February 2002, the function will return ERROR, because February only holds 28 days in a non-leap year.
All dates that are not bewteen 1 January 2000 and 31 December 2099 will also return ERROR.
Requirements
Header file:
lib.hLibrary file:
libSTARTUPOPH5000.a
Sample
#include <stdio.h>
#include "lib.h"
void main( void )
{
struct date_struct d;
d.da_year = 2008;
d.da_mon = 2;
for(;;)
{
d.da_day = 29; // not 29 days in non leap year
if( CheckDate( &d ) == OK )
printf("\fDate ok!!\n");
else
printf("\fIllegal Date!!");
while( !kbhit() )
Idle();
ResetKey();
d.da_day = 28;
if( CheckDate( &d ) == OK )
printf("\fDate ok!!\n");
else
printf("\fIllegal Date!!");
while( !kbhit() )
Idle();
ResetKey();
}
}
Last updated: 2020/10/07