# [date.h] Type: Date

## contents

#include "standard.h"
#include "sink.h"

## The Type

       The data type DATE is implemented as number of days since 01.01.0000.
       This origin date is represented by the number 0.

       The rules for the conversion of a date
         internal format <-->  external day/month/year-format
       rely on the Gregorian calendar:

       1) A normal year has 365 days, a leap year 366 days.
       2) All years, divisible by 4, are leap years, except
       3) the years, divisible by 100, this except
       4) the years, divisible by 400.

    typedef long Date; /* range DMY(01,01,0000) .. DMY(31,12,9999) */

## Init

    void date_init(void)

init date module

## Date operations

    c_bool LeapYear(int Year)

whether 'Year' is a leap year

    c_bool validDMY(int Day, int Month, int Year)

whether 'Day'.'Month'.'Year' is a valid date

    Date DMY(int Day, int Month, int Year)

converts 'Day'.'Month'.'Year' into the internal date format

    int Year(Date days)

year of 'days' ( result >= 0 )

    int Month(Date date)

month of 'date' ( result >= 1 )

    int Day(Date date)

day of 'date' ( result >= 1 )

    int WeekDay(Date date)

weekday of 'date' ( sunday = 0, saturday = 6 )

    Date Today(void)

current date ( system clock )

    c_string CurTime(void)

current time ( system clock ); allocs memory

    int MonthLength(int Month, int Year)

the number of days in month

    Date Str_Date(c_string date)

converts 'date' [ "dd.mm.yy" | "dd.mm.yyyy" ]
into the internal date format

    c_string Date_Str(Date date)

converts 'date' to string type [ "tt.mm.jjjj" ]; allocs memory

## Debug

    void pDate4(Date date)

print 'date' [ "tt.mm.jjjj" ]

    void pDate2(Date date)

print 'date' [ "tt.mm.jj" ]

    void pDateS(Date date)

print 'date' [ "...Anno..." ]