SIMPOL Documentation

date

Description

Objects of type date contain a value which represents a date, and can be accessed either as a whole or by component, such as day, month and year. Valid dates are in the range 1/1/0001 to 31/12/9999, and the Gregorian calendar is assumed throughout that period.

Type Tags

None

Object Value

The value of an object of type date is the number of days since 1/1/0001, and can be read or written.

date.new()

Description

Creates a new date object and sets its initial value.

Prototype

date.new ( integer date )

Parameters

ParameterDefault valueType nameDescription
date.nulinteger The day count to be assigned to the new object.

Properties

PropertyTypeDescription
typetype Specifies the date type object.

Methods

dayinmonth()

Description

Returns the day of the month for the date in the object.

Prototype

datevar.dayinmonth ()

Parameters

None

dayinweek()

Description

Returns the day of the week for the date in the object, where 1 is Monday and 7 is Sunday.

Prototype

datevar.dayinweek ()

Parameters

None

dayinyear()

Description

Returns the day in the year for the date in the object, where January 1st is day 1.

Prototype

datevar.dayinyear ()

Parameters

None

month()

Description

Returns the month number for the date in the object.

Prototype

datevar.month ( boolean total )

Parameters
ParameterDefault valueType nameDescription
total.trueboolean Indicates whether months are to be counted from the beginning of the current year, or from the beginning of year 1. If .false then the returned value will range from 1 for January to 12 for December. If .true then the returned value will range from 1 for January 0001 to 119988 for December 9999. If the value of this parameter is either .nul or .inf then the result will be .nul.

set()

Description

Sets the value in a date object from the components specified. The year component must always be given. Also, either the dayinyear (and not the month or dayinmonth) or the month and dayinmonth (and not the dayinyear) components must be given.

Prototype

datevar.set ( integer year, integer month, integer dayinmonth, integer dayinyear )

Parameters
ParameterDefault valueType nameDescription
yearNoneinteger Specifies the year component of the new date value, which must be in the range 1 to 9999. If the value of this parameter is .nul then the date will be set to .nul and if the value of this parameter is .inf then the date will be set to .inf.
month.nulinteger Specifies the month component of the new date value, which must be in the range 1 to 12. If the value of this parameter is .nul then the date will be set to .nul and if the value of this parameter is .inf then the date will be set to .inf.
dayinmonth.nulinteger Specifies the day of the month of the new date value, which must be in the range 1 to 28, 29, 30 or 31 depending on the year and month that are specified. If the value of this parameter is .nul then the date will be set to .nul and if the value of this parameter is .inf then the date will be set to .inf.
dayinyear.nulinteger Specifies the day in the year of the new date value, which must be in the range 1 to 365 or 366 depending on whether or not the year specified is a leap year. If the value of this parameter is .nul then the date will be set to .nul and if the value of this parameter is .inf then the date will be set to .inf.

setnow()

Description

Sets the specified object to now according to the OS and returns the value of now for the date type.

Prototype

datevar.setnow ()

Parameters

None

year()

Description

Returns the year for the date in the object.

Prototype

datevar.year ()

Parameters

None