This function gets date information.

Syntax

short GetDate(
  struct date_struct *datep
);

Parameters

datep
[out] Pointer to the date_struct structure.

Return value

Returns OK if the function succeeds, other values otherwise.

Remarks

Current date is stored in the date_struct structure pointed by datep.
The date can be set with the SetDate function.

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include "lib.h"

void main(void)
{
    struct date_struct datep;
    struct time_struct timep;
    char   mes[30];

    datep.da_year = 2007;
    datep.da_day = 25;
    datep.da_mon = 12;
    timep.ti_hour = 0;
    timep.ti_min = 0;
    timep.ti_sec = 0;

    SetDate(&datep);
    SetTime(&timep);

    GetDate(&datep);
    GetTime(&timep);

    sprintf( mes, "date[%04d.%02d.%02d]\n",
                   datep.da_year, datep.da_mon, datep.da_day);
    printf( mes );
    sprintf( mes, "time[%02d:%02d:%02d]\n",
       timep.ti_hour, timep.ti_min, timep.ti_sec);
    printf( mes );

    for( ;; );
}

Last updated: 2020/10/07