Date

The Date object is provided to make it easier to deal with variables representing dates. It converts automatically to an ActiveX VT_DATE value and so can function as a drop-in replacement for a scripting language's native date variables. The main advantage is that it retains milliseconds, unlike VT_DATE which has a one second resolution. It also provides some utility methods to manipulate dates. The Item object has a number of properties that returns Date objects.

You can create a new Date object using the DOpusFactory.Date method.

  

Property Name

Return Type

Description

<default value>

date

Returns a VT_DATE representing the value of this Date object (excluding the milliseconds).

day

int

Get or set the day value of the date.

hour

int

Get or set the hour value of the date.

min 

int

Get or set the minute value of the date.

month

int

Get or set the month value of the date.

ms

int

Get or set the milliseconds value of the date.

sec

int

Get or set the seconds value of the date.

wday 

int

Get the day-of-the-week value of the date.

year

int

Get or set the year value of the date.

 

Method Name

Arguments

Return Type

Description

Add

<int:value>
<string:type>

none

Adds the specified value to the date. The interpretation of the specified value is controlled by the type string:

l - milliseconds
s - seconds
m - minutes
h - hours
d - days
w - weeks
M - months
y - years

Clone

none

object:Date

Returns a new Date object set to the same date as this one.

Compare

<date:other>
<string:type>
<int:tolerance>

int

Compares this date against the other date. The return value will be 0 (equal), 1 (greater) or -1 (less).

The optional type string controls how the comparison is performed:

s - ignore seconds. If specified, the optional tolerance argument specifies the comparison tolerance in seconds.
sD - ignore seconds, and compensate automatically for daylight savings.
t - compare times only
d - compare dates only

Format

<string:flags>

string

Returns a formatted date or time string in the same format as shown in date/time columns in the Lister. By default a combined date/time string will be returned. Set the optional <flags> parameter to "t" to return only a time string, or "d" to return only a date string.

FromUTC

none

object:Date

Returns a new Date object with the date converted from UTC (based on the local time zone).

Reset

none

none

Resets the date to the current local date/time.

Set

<date:newdate>

none

Sets the value of this Date object to the supplied date.

Sub

<int:value>
<string:type>

none

Subtracts the specified value from the date. The parameters are the same as for the Add method.

ToUTC

none

object:Date

Returns a new Date object with the date converted to UTC (based on the local time zone).