Share via


DataFunctions.Date Method (PIA)

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

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop
…
Public Function Date(dtDate As DateTime,
 Optional vtLocale As Object) As Object

[C#]

using Microsoft.CommerceServer.Interop;
…
public object Date(System.DateTimedtDate,
 objectvtLocale);

Parameters

[Visual Basic .NET]

  • dtDate
    A DateTime that contains the date to format.
  • vtLocale
    An Object that specifies the locale to use to convert the date to a string. If this parameter is not specified, the value of the Locale property of the DataFunctions object is used.

[C#]

  • dtDate
    A System.DateTime that contains the date to format.
  • vtLocale
    An object that specifies the locale to use to convert the System.DateTime object to a 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 string Object that contains the date value formatted as a string; otherwise, Null is returned.

[C#] This method returns an object containing the date value formatted as a string.

Exceptions

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

Example

[Visual Basic .NET]

Dim Result As Object
Dim dDateVar As Date
' dDateVar is a Date containing a valid date
DataFunctions df = New DataFunctions()
' Set Locale to USA
df.Locale = 1033
Result = df.Date(dDateVar)
Response.Write("USA: " & Result & "<P>")

[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.DateTime

DataFunctions.ValidateDateTime

DataFunctions.ConvertDateString

Copyright © 2005 Microsoft Corporation.
All rights reserved.