Share via


DataFunctions.ConvertDateString Method (PIA)

Use this method to convert a date string to a date object, based on the default or specified locale.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop
…
Public Function ConvertDateString(vtDate As Object,
 Optional vtLocale As Object) As Object

[C#]

using Microsoft.CommerceServer.Interop;
…
public object ConvertDateString(objectvtDate,
  objectvtLocale);

Parameters

[Visual Basic .NET]

  • vtDate
    An Object that contains a string representation of the date to convert.
  • vtLocale
    An Object that specifies the locale to use when processing the string. If this parameter is not specified, the value of the Locale property of the DataFunctions object is used.

[C#]

  • vtDate
    An object that contains a string representation of the date to convert.
  • vtLocale
    An object that specifies the locale to use when processing the string. If you want the value of the Locale property of the DataFunctions object to be used, pass Type.Missing for this parameter.

Return Values

[Visual Basic .NET] If this method completes successfully, it returns a date Object containing the converted value; otherwise, Null is returned.

[C#] This method returns an object containing the converted date.

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

Remarks

In some cases, the DataFunctions.ConvertDateString method returns Null, for example, the DataFunctions.ConvertDateString method returns null when converting a string representation of the date to the date object type for Latvian and Bulgarian locales. To avoid this problem, remove the constant string added at the end of the Date Representation String according to the Regional Settings in the Control Panel.

Example

[Visual Basic .NET]

' Converts date using US and France locales
Dim Result As Object
DataFunctions df = new DataFunctions()
df.Locale = 1036
Result = df.ConvertDateString("12/1/2000")
Response.Write("France: " & Result & "<P>")
df.Locale = 1033
Result = df.ConvertDateString("12/1/2000")
Response.Write("USA: " & Result)

[C#]

No example available.

Requirements

Namespace: Microsoft.CommerceServer.Interop

Platforms: Windows 2000, Windows Server 2003

Assembly: mscsasphelplib (in mscsasphelplib.dll)

See Also

DataFunctions Class

DataFunctions.Locale

DataFunctions.ConvertDateTimeString

DataFunctions.Date

DataFunctions.DateTime

Page.RequestTime

Copyright © 2005 Microsoft Corporation.
All rights reserved.