COMVariant::createDateFromYMD Method

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

Syntax

client server public static COMVariant createDateFromYMD(
    int year, 
    int month, 
    int day, 
   [COMVariantInOut inOutFlag])

Run On

Called

Parameters

  • year
    Type: int
    The year part of the date.
  • month
    Type: int
    The month part of the date.
  • day
    Type: int
    The day part of the date.
  • 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:
    COMVariantInOut::OUT_RETVAL

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

This method allows you to use dates that are outside the range for the Microsoft Dynamics AXdate data type (01\01\1901 to 31\12\2154). For dates within the date range, you can use the COMVariant.createFromDate method.

Examples

The following example creates a COMVariant object and initializes it with the date 01 January 4015.

COMVariant myDate; 
 
myDate = COMVariant::createDateFromYMD(4015,1,1);

See Also

COMVariant Class

COMVariant::createFromTime Method

COMVariant::createFromDateAndTime Method

COMVariant.variantType Method

COMVariant.date Method