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
Parameter | Default value | Type name | Description |
---|---|---|---|
datetime | .nul | integer | The microsecond count to be assigned to the new object. |
Properties
Property | Type | Description |
---|---|---|
type | type | 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
Parameter | Default value | Type name | Description |
---|---|---|---|
total | .true | boolean |
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
Parameter | Default value | Type name | Description |
---|---|---|---|
total | .true | boolean |
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
Parameter | Default value | Type name | Description |
---|---|---|---|
total | .true | boolean |
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
Parameter | Default value | Type name | Description |
---|---|---|---|
total | .true | boolean |
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
Parameter | Default value | Type name | Description |
---|---|---|---|
total | .true | boolean |
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
Parameter | Default value | Type name | Description |
---|---|---|---|
total | .true | boolean |
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
,
integer year
,
integer month
,
integer dayinmonth
,
integer dayinyear
,
integer microseconds
,
integer milliseconds
,
integer seconds
,
integer minutes
)
hours
Parameters
Parameter | Default value | Type name | Description |
---|---|---|---|
year | .nul | integer |
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 | .nul | integer |
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 | .nul | integer |
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 | .nul | integer |
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 | .nul | integer |
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 | .nul | integer |
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 | .nul | integer |
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 | .nul | integer |
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 | .nul | integer |
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