Windows Dev Center

Expand Minimize

VarDateFromUdateEx function

Converts a time and date converted from MS-DOS format to variant format.

Syntax


HRESULT VarDateFromUdateEx(
  _In_  UDATE *pudateIn,
  _In_  LCID  lcid,
  _In_  ULONG dwFlags,
  _Out_ DATE  *pdateOut
);

Parameters

pudateIn [in]

The unpacked date.

lcid [in]

The locale identifier.

dwFlags [in]

VAR_VALIDDATE if the date is valid.

pdateOut [out]

The packed date.

Return value

This function can return one of these values.

Return codeDescription
S_OK

Success.

E_INVALIDARG

One of the arguments is not valid.

E_OUTOFMEMORY

Insufficient memory to complete the operation.

 

Remarks

The UDATE structure is used with VarDateFromUdateEx, VarDateFromUdate, and VarUdateFromDate. It represents an unpacked date.

typedef struct {
    SYSTEMTIME st;
    USHORT  wDayOfYear;
} UDATE;

The VarDateFromUdate function accepts invalid dates and tries to fix them when resolving to a VARIANT time. Only days are fixed, so invalid month values result in an error being returned. Days are checked to verify that they are in the range of 1 through 31. Negative days and days greater than 31 result in an error. A day less than 31 but greater than the maximum day in that month has the day promoted to the appropriate day of the next month. For example, an invalid date such as 2/29/2001 resolves to 3/1/2001. A day equal to zero resolves as the last day of the previous month. For example, an invalid date such as 2/0/2001 resolves to 1/31/2001.

Windows Phone 8.1: This API is supported.

Requirements

Header

OleAuto.h

Library

OleAut32.lib

DLL

OleAut32.dll

 

 

Community Additions

ADD
Show:
© 2015 Microsoft