SIMPOL Documentation

datetime

Description

Objects of type datetime contain a value which represents a date and a time of day, and can be accessed either as a whole or by component, such as month, dayinmonth, hour and minute. Valid datetimes are from midnight at the beginning of 1/1/0001 to 23:59:59.999999 on 31/12/9999.

Type Tags

None

Object Value

The value of an object of type datetime is the number of microseconds since midnight at the beginning of 1/1/0001 and can be read or written.

datetime.new()

Description

Creates a new datetime object and sets its initial value.

Prototype

datetime.new ( integer datetime )

Parameters

ParameterDefault valueType nameDescription
datetime.nulinteger The microsecond count to be assigned to the new object.

Properties

PropertyTypeDescription
typetype Specifies the datetime type object.

Methods

dayinmonth()

Description

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

Prototype

datetimevar.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

datetimevar.dayinweek ()

Parameters

None

dayinyear()

Description

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

Prototype

datetimevar.dayinyear ()

Parameters

None

hours()

Description

Returns the number of hours in the datetime value.

Prototype

datetimevar.hours ( boolean total )

Parameters
ParameterDefault valueType nameDescription
total.trueboolean Indicates whether hours are to be counted from time zero or from the last whole day. If .false then the hours component of the datetime value is returned. If .true then the total number of hours in the datetime value is returned. If the value of this parameter is either .nul or .inf then the result will be .nul.

microseconds()

Description

Returns the number of microseconds in the datetime value.

Prototype

datetimevar.microseconds ( boolean total )

Parameters
ParameterDefault valueType nameDescription
total.trueboolean Indicates whether microseconds are to be counted from time zero or from the last whole millisecond. If .false then the microseconds component of the datetime value is returned. If .true then the total number of microseconds in the datetime value is returned. If the value of this parameter is either .nul or .inf then the result will be .nul.

milliseconds()

Description

Returns the number of milliseconds in the datetime value.

Prototype

datetimevar.milliseconds ( boolean total )

Parameters
ParameterDefault valueType nameDescription
total.trueboolean Indicates whether milliseconds are to be counted from time zero or from the last whole second. If .false then the milliseconds component of the datetime value is returned. If .true then the total number of milliseconds in the datetime value is returned. If the value of this parameter is either .nul or .inf then the result will be .nul.

minutes()

Description

Returns the number of minutes in the datetime value.

Prototype

datetimevar.minutes ( boolean total )

Parameters
ParameterDefault valueType nameDescription
total.trueboolean Indicates whether minutes are to be counted from time zero or from the last whole hour. If .false then the minutes component of the datetime value is returned. If .true then the total number of minutes in the datetime value is returned. If the value of this parameter is either .nul or .inf then the result will be .nul.

month()

Description

Returns the month number for the date in the object.

Prototype

datetimevar.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.

seconds()

Description

Returns the number of seconds in the datetime value.

Prototype

datetimevar.seconds ( boolean total )

Parameters
ParameterDefault valueType nameDescription
total.trueboolean Indicates whether seconds are to be counted from time zero or from the last whole minute. If .false then the seconds component of the datetime value is returned. If .true then the total number of seconds in the datetime value is returned. If the value of this parameter is either .nul or .inf then the result will be .nul.

set()

Description

Sets the value in a datetime object from the components specified. If the year component is specified then either the dayinyear or the dayinmonth) and the month components must be specified, but not both. If the year component is not specified then none of the month, dayinmonth or dayinyear components may be specified. Any or all or the microseconds, milliseconds, seconds, minutes and hours components may be specified. To specify the time components, it is necessary to supply the parameter name of the component, such as dt.set(hours=5).

Prototype

datetimevar.set ( integer year, integer month, integer dayinmonth, integer dayinyear, integer microseconds, integer milliseconds, integer seconds, integer minutes, integer hours )

Parameters
ParameterDefault valueType nameDescription
year.nulinteger Specifies the year component of the new datetime value, which must be in the range 1 to 9999. If the value of this parameter is .nul then the datetime will be set to .nul and if the value of this parameter is .inf then the datetime will be set to .inf.
month.nulinteger Specifies the month component of the new datetime value, which must be in the range 1 to 12. If the value of this parameter is .nul then the datetime will be set to .nul and if the value of this parameter is .inf then the datetime will be set to .inf.
dayinmonth.nulinteger Specifies the day of the month of the new datetime 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 datetime will be set to .nul and if the value of this parameter is .inf then the datetime will be set to .inf.
dayinyear.nulinteger Specifies the day in the year of the new datetime 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 datetime will be set to .nul and if the value of this parameter is .inf then the datetime will be set to .inf.
microseconds.nulinteger Specifies the microseconds component of the new datetime value, which must be in the range 0 to 999. If the value of this parameter is .nul then the datetime will be set to .nul and if the value of this parameter is .inf then the datetime will be set to .inf.
milliseconds.nulinteger Specifies the milliseconds component of the new datetime value, which must be in the range 0 to 999. If the value of this parameter is .nul then the datetime will be set to .nul and if the value of this parameter is .inf then the datetime will be set to .inf.
seconds.nulinteger Specifies the seconds component of the new datetime value, which must be in the range 0 to 59. If the value of this parameter is .nul then the datetime will be set to .nul and if the value of this parameter is .inf then the datetime will be set to .inf.
minutes.nulinteger Specifies the minutes component of the new datetime value, which must be in the range 0 to 59. If the value of this parameter is .nul then the datetime will be set to .nul and if the value of this parameter is .inf then the datetime will be set to .inf.
hours.nulinteger Specifies the hours component of the new datetime value, which must be in the range 0 to 87649415. If the value of this parameter is .nul then the datetime will be set to .nul and if the value of this parameter is .inf then the datetime 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 datetime type.

Prototype

datetimevar.setnow ()

Parameters

None

year()

Description

Returns the year for the date in the object.

Prototype

datetimevar.year ()

Parameters

None