Share via


COMVariant::createFromDate Method

Creates a new COMVariant object and initializes it with a date value in one operation.

Syntax

client server public static COMVariant createFromDate(date value, [COMVariantInOut inOutFlag])

Run On

Called

Parameters

  • value
    Type: date
    The date value that is used to initialize the object.
  • inOutFlag
    Type: COMVariantInOut Enumeration
    A flag that determines whether the object can be used to pass data to a COM method or COM property, to receive data, or both. This parameter is optional.
    Possible values are:

Return Value

Type: COMVariant Class
The new COMVariant object.

Remarks

The COMVariant object that is created by this method has the data type VT_DATE (date/time).

You can change the data type of an existing COMVariant object to VT_DATE by using the variantType method or by passing in a time value by using the date property method.

If you want to use a date that is outside the range for the Axapta date type (01\01\1901 to 31\12\2154), use the COMVariant.createDateFromYMD method.

Examples

The following example creates a COMVariant object and initializes it with the current date.

COMVariant theDay; 
 
theDay = COMVariant::createFromDate(today()); 
info(theDay.toString());

See Also

COMVariant Class

COMVariant::createFromTime Method

COMVariant::createFromDateAndTime Method

COMVariant.variantType Method

COMVariant.date Method