Skip to content

DF_DRIVER_DRIVER_DATE_FORMAT

The date format used by the ODBC driver.

Level

Driver

Supported by

DataFlex ODBC Driver, revision 5 and higher

Type

Enumerated Type, temporary

Access

Read/Write

Values

  • DF_DATE_USA
  • DF_DATE_EUROPEAN
  • DF_DATE_MILITARY

Syntax

Use cli.pkg
Get_Attribute DF_DRIVER_DRIVER_DATE_FORMAT of {driverNumber} to {IntegerVariable}
Set_Attribute DF_DRIVER_DRIVER_DATE_FORMAT of {driverNumber} ;
to {DF_DATE_USA|DF_DATE_EUROPEAN|DF_DATE_MILITARY}

Driver Configuration Keyword

Driver_Date_Format

Remarks

ODBC demands that drivers use the military format (yyyy-mm-dd) in the supported SQL. Nevertheless, there are drivers that do not use this format, but rather a format that depends on the country settings of the machine or the database client software. For those environments, the driver date format can be set.

This default value is copied to the database level when logging in to the database. The actual value in use for an active connection is that on the database level. This attribute merely reflects a default.

Sample Code

The sample code below shows the current setting for a given driver.

Function DriverIndex String sDriver Returns Integer
    String sCurrentDriver
    Integer iNumberOfDrivers iDriver iCount
    Move 0 to iDriver
    Get_Attribute DF_NUMBER_DRIVERS to iNumberOfDrivers
    For iCount From 1 To iNumberOfDrivers
        Get_Attribute DF_DRIVER_NAME of iCount To sCurrentDriver
        If (Uppercase(sCurrentDriver) = Uppercase(sDriver)) Begin
            Move iCount to iDriver
        End
    Loop
    Function_Return iDriver
End_Function // DriverIndex

Procedure ShowDriverAttribute
    Integer iAttribValue iDriver
    Get DriverIndex "MSSQLDRV" to iDriver
    Get_Attribute DF_DRIVER_DRIVER_DATE_FORMAT of iDriver to iAttribValue
    Showln "Date format: " iAttribValue ", " ;
    (If(iAttribValue = DF_DATE_MILITARY, "MILITARY", If(iAttribValue = DF_DATE_EUROPEAN, "EUROPEAN", "US")))
End_Procedure // ShowDriverAttribute

The driverNumber can be obtained using DF_NUMBER_DRIVERS.