26.6 Calendar Arithmetic

All calendar functions use the Gregorian calendar.

  • DaysInYear( year ) F

    returns the number of days in a year.

  • DaysInMonth( month, year ) F

    returns the number of days in month number month of year.

    gap> DaysInYear(1998);
    365
    gap> DaysInMonth(3,1998);
    31
    

  • DMYDay( day ) F

    converts a number of days, starting 1-Jan-1970 to a list [day,month,year]

  • DayDMY( dmy ) F

    returns the number of days from 01-Jan-1970 to the day given by dmy. dmy must be a list of the form [day,month,year].

  • WeekDay( date ) F

    returns the weekday of a day given by date. date can be a number of days since 1-Jan-1970 or a list [day,month,year].

  • StringDate( date ) F

    converts date to a readable string. date can be a number of days since 1-Jan-1970 or a list [day,month,year].

    gap> DayDMY([1,1,1970]);DayDMY([2,1,1970]);
    0
    1
    gap> DMYDay(12345);
    [ 20, 10, 2003 ]
    gap> WeekDay([11,3,1998]);
    "Wed"
    gap> StringDate([11,3,1998]);
    "11-Mar-1998"
    

  • HMSMSec( msec ) F

    converts a number msec of milliseconds into a list [hour,min,sec,milli].

  • SecHMSM( hmsm ) F

    is the reverse of HMSMSec.

  • StringTime( time ) F

    converts time (given as a sumber of milliseconds or a list [hour,min,sec,milli]) to a readable string.

    gap> HMSMSec(Factorial(10));
    [ 1, 0, 28, 800 ]
    gap> SecHMSM([1,10,5,13]);
    4205013
    gap> StringTime([1,10,5,13]);
    " 1:10:05.013"
    

    [Top] [Previous] [Up] [Next] [Index]

    GAP 4 manual
    February 2000