dtm - Date time data type
Module Description
The dtm module implements a [gregorian] date and time data type.
Module Words
Date time structure
dtm%
( -- n )
Get the required space for a dtm variable
Constants
dtm.unix-epoch
( -- n )
Unix epoch [1970]
dtm.start-epoch
( -- n )
Start epoch [1583]
dtm.sunday
( -- n )
Sunday
dtm.monday
( -- n )
Monday
dtm.tuesday
( -- n )
Tuesday
dtm.wednesday
( -- n )
Wednesday
dtm.thursday
( -- n )
Thursday
dtm.friday
( -- n )
Friday
dtm.saturday
( -- n )
Saturday
dtm.january
( -- n )
January
dtm.february
( -- n )
February
dtm.march
( -- n )
March
dtm.april
( -- n )
April
dtm.may
( -- n )
May
dtm.june
( -- n )
June
dtm.july
( -- n )
July
dtm.august
( -- n )
August
dtm.september
( -- n )
September
dtm.october
( -- n )
October
dtm.november
( -- n )
November
dtm.december
( -- n )
December
Date time variable creation, initialisation and destruction
dtm-init
( dtm -- )
Initialise the date/time with the current date and time
dtm-create
( "<spaces>name" -- ; -- dtm )
Create a date/time variable in the dictionary with the current date/time
dtm-new
( -- dtm )
Allocate a date/time variable on the heap with the current date/time
dtm-free
( dtm -- )
Free the date/time variable from the heap
Module words
dtm+leap-year?
( n -- flag )
Check if the year n is a leap year
dtm+calc-leap-years
( n1 n2 -- n3 )
Calculate the number of leap years in the year range [n2..n1]
dtm+days-in-year
( n1 -- n2 )
Get the number of days in the year n1
dtm+days-in-month
( n1 n2 -- n3 )
Get the number of days in the month n1 and year n2
dtm+days-till-month
( n1 n2 -- n3 )
Get the number of days till the month n1 and year n2
dtm+milli?
( n -- flag )
Check if the milliseconds n are valid
dtm+second?
( n -- flag )
Check if the seconds n are valid
dtm+minute?
( n -- flag )
Check if the minutes n are valid
dtm+hour?
( n -- flag )
Check if the hours n are valid
dtm+day?
( n1 n2 n3 -- flag )
Check if the day n1 in the month n2 and year n3 is valid
dtm+month?
( n -- flag )
Check if the month n is valid
dtm+year?
( n -- flag )
Check if the year n [>1582] is valid
Member words
dtm-milli@
( dtm -- n )
Get the milliseconds
dtm-milli!
( n dtm -- )
Set the milliseconds
dtm-second@
( dtm -- n )
Get the seconds
dtm-second!
( n dtm -- )
Set the seconds
dtm-minute@
( dtm -- n )
Get the minutes
dtm-minute!
( n dtm -- )
Set the minutes
dtm-hour@
( dtm -- n )
Get the hour
dtm-hour!
( n dtm -- )
Set the hour
dtm-day@
( dtm -- n )
Get the day
dtm-day!
( n dtm -- )
Set the day
dtm-month@
( dtm -- n )
Get the month
dtm-month!
( n dtm -- )
Set the month
dtm-year@
( dtm -- n )
Get the year
dtm-year!
( n dtm -- )
Set the year
Set words
dtm-set-date
( n1 n2 n3 dtm -- )
Set the date with day n1, month n2 and year n3
dtm-set-time
( n1 n2 n3 n4 dtm -- )
Set the time with milliseconds n1, seconds n2, minutes n3 and hours n4
dtm-set
( n1 n2 n3 n4 n5 n6 n7 dtm -- )
Set the date/time with milliseconds n1, seconds n2, minutes n3, hours n4, day n5, month n6 and year n7
dtm-set-now
( dtm -- )
Set the date time with the current date/time
dtm-set-with-days
( d1 n2 dtm -- )
Set the date with days d1 since epoch n2
dtm-set-with-seconds
( d n dtm -- )
Set the date/time with d seconds since epoch n
Get words
dtm-get
( dtm -- n1 n2 n3 n4 n5 n6 n7 )
Get the date/time, return milliseconds n1, seconds n2, minutes n3, hours n4, day n5, month n6 and year n7
dtm-get-date
( dtm -- n1 n2 n3 )
Get the date, return day n1, month n2 and year n3
dtm-get-time
( dtm -- n1 n2 n3 n4 )
Get the time, return milliseconds n1, seconds n2, minutes n3 and hours n4
dtm-weekday
( dtm -- n )
Get the week day from the date
dtm-yearday
( dtm -- n )
Get the day number [in the year] from the date
dtm-iso-weeknumber
( dtm -- n1 n2 )
Get the iso week number n1 and year n2 from the date
Epoch words
dtm-calc-days-since-epoch
( n dtm -- d )
Calculate the number of days since epoch n from the date
dtm-calc-seconds-since-epoch
( n dtm -- d )
Calculate the number of seconds since epoch n from the date/time
Compare words
dtm-compare
( n1 n2 n3 n4 n5 n6 n7 dtm -- n )
Compare the date/time with millisconds n1, seconds n2, minutes n3, hours n4, day n5, month n6 and year n7
dtm^compare
( dtm1 dtm2 -- n )
Compare two date/times, return the compare result [-1,0,1]
Inspection
dtm-dump
( dtm -- )
Dump the date/time variable
generated 10-Apr-2008 by
ofcfrth-0.5.0