Share via


IDataFunctions_4_0::ValidateDateTime Method [C++]

Use this method to check whether a string contains a valid date, time, or date and time, and optionally to check against a specified range.

Definition

[C++]

HRESULT IDataFunctions_4_0::ValidateDateTime(VARIANTvtDate,
 VARIANTvtMin,
 VARIANTvtMax,
 VARIANT*pvtValid);

[Visual Basic]

Function ValidateDateTime(vtDate As Variant,
 vtMin As Variant,
 vtMax As Variant) As Variant

Parameters

  • vtDate[C++]
    [in] A VARIANT that contains the value to validate. This value can be a date, a time, or both.
  • vtDate[Visual Basic]
    A Variant that contains the value to validate. This value can be a date, a time, or both.
  • vtMin[C++]
    [in] A VARIANT that contains a value specifying the low end of the range. The default value for this parameter is NULL, which means that the vtMin parameter is ignored in the range validation.
  • vtMin[Visual Basic]
    A Variant that contains a value specifying the low end of the range. The default value for this parameter is NULL, which means that the vtMin parameter is ignored in the range validation.
  • vtMax[C++]
    [in] A VARIANT that contains a value specifying the high end of the range. The default value for this parameter is NULL, which means that the vtMax parameter is ignored in the range validation.
  • vtMax[Visual Basic]
    A Variant that contains a value specifying the high end of the range. The default value for this parameter is NULL, which means that the vtMax parameter is ignored in the range validation.
  • pvtValid[C++]
    [out, retval] A pointer to a VARIANT used to return a Boolean that indicates whether the vtDate parameter is valid. A value of TRUE indicates the vtDate parameter is a valid date, time, or date/time, and that it is within the given range, if any.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

[Visual Basic] If this method completes successfully, it returns a Boolean Variant indicating whether the vtDate parameter is valid. A value of True indicates the vtDate parameter is a valid date, time, or date/time, and that it is within the given range, if any.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

[C++] The pvtValid parameter contains valid data only if the method completes successfully.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[Visual Basic]

Example

' vResult is a Variant, vSourceDate is a Variant containing
' a string representation of a date or date and time
Set MSCSDataFunctions = Server.CreateObject("Commerce.DataFunctions")
vResult = MSCSDataFunctions.ValidateDateTime(vSourceDate,"1/1/1900", _
    "12/31/2525")

See Also

[C++]DataFunctions Object

[C++]IDataFunctions_4_0::Date

[C++]IDataFunctions_4_0::DateTime

[C++]IDataFunctions_4_0::Time

[C++]IDataFunctions_4_0::ConvertDateString

[C++]IDataFunctions_4_0::ConvertDateTimeString

[C++]IDataFunctions_4_0::ConvertTimeString

[Visual Basic]DataFunctions Object

[Visual Basic]DataFunctions.Date

[Visual Basic]DataFunctions.DateTime

[Visual Basic]DataFunctions.Time

[Visual Basic]DataFunctions.ConvertDateString

[Visual Basic]DataFunctions.ConvertDateTimeString

[Visual Basic]DataFunctions.ConvertTimeString

Copyright © 2005 Microsoft Corporation.
All rights reserved.