SetFormatDatetime Method for LCField

This method changes the format setting for a datetime field. Calling this method clears all values for this field. The field must be of a datetime type, or error LCFAIL_TYPE_MISMATCH will occur.

Defined In

LCField

Syntax

Call thisField.SetFormatDatetime (datetimeFlags, size)

Parameters

Parameter

Description

dateTimeFlags

Long. Formatting flags that govern how the data is written to or read from an external system.

Flag

Description

LCDATETIMEF_NO_DATE

Source type is time only.

LCDATETIMEF_NO_TIME

Source type is date only.

The datetimeFlags do not affect the data. As with the size value, it is only relevant when interacting with the external system. The flags will have no effect on the conversion of a field's value to or from a stream or text.

size

Long. Optional, >= 1. Size in bytes assigned to the datetime field. Zero indicates the size of an ®Connector Datetime (8 bytes). The default is 0.

The size value is used for metadata creation by data systems which support datetime data types of different sizes. For systems which support only a single datetime data type, the value of size is ignored. The default value for size is zero.

For example, Sybase supports both a 4-byte datetime and an 8-byte version. When building up a fieldlist that will be used to create a Sybase table (see LCConnection.Create for an example), use the SetFormatDatetime method to indicate which size datetime data type should be used.

Example

Option Public
Uselsx "*lsxlc"  
Sub Initialize
  Dim field As New LCField (LCTYPE_DATETIME, 1)
  Dim flags As Long
  Dim size As Long
  Call field.SetFormatDatetime (LCDATETIMEF_NO_TIME, 0)
  Call field.GetFormatDateTime (flags, size)
  Print "The datetime format flag setting is " & Hex(flags) & "h"
End Sub

Example Output

The datetime format flag setting is 2h.