' Date arithmetic: DATEADD, DATEDIFF, DATEPART
#COMPILE EXE
#DIM ALL

FUNCTION PBMAIN() AS LONG
    LOCAL today  AS LONG
    LOCAL future  AS LONG
    LOCAL diff  AS LONG
    LOCAL part  AS LONG
    today = DATEVALUE(DATE$)
    PRINT "Today serial:"; today

    future = DATEADD(today, 30, 0)
    PRINT "Today + 30 days (serial):"; future

    diff = future - today
    PRINT "Difference in days:"; diff

    part = DATEPART(today, 2)
    PRINT "Current year (part=2):"; part

    PRINT "Date arithmetic operations complete."

    FUNCTION = 0
END FUNCTION
