Share via


DataFunctions.DateTime Method (PIA)

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

Definition

[Visual Basic .NET]

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

[C#]

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

Parameters

[Visual Basic .NET]

  • dtDate
    A Date that contains the date/time value to convert.
  • 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/time value to convert.
  • 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 string representation of the specified date/time value; otherwise, Null is returned.

[C#] This method returns an object containing the string representation of the specified date/time value.

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 DateVar As Date
' DateVar is a Date containing a valid date time value
DataFunctions df = New DataFunctions()
' Set Locale to USA
df.Locale = 1033
Result = df.DateTime(DateVar)
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.Date

DataFunctions.ValidateDateTime

Page.RequestTime

Copyright © 2005 Microsoft Corporation.
All rights reserved.