Product Documentation

FairCom DB API for C

Previous Topic

Next Topic

ctdbSetFieldDefaultDateTimeType

Sets the default field value date and time type.

DECLARATION

CTDBRET ctdbSetFieldDefaultDateTimeType(CTHANDLE Handle, CTDATE_TYPE dateType, CTTIME_TYPE timeType);

DESCRIPTION

Sets the default field value date and time type to be used when converting CT_DATE, CT_TIME and CT_TIMES string values. By default the date type is CTDATE_MDCY and the time type is CTTIME_HMS. Use this function to modify the default values.

ctdbSetFieldDefaultDateTimeType() modifies both the date and time types. If you wish to change only the default date time, but keep the current time type, use the following example:

ctdbSetFieldDefaultDateTimeType(hField, CTDATE_YMD, ctdbGetFieldDefaultTimeType(hField));

You can use the same approach to change only the time type, keeping the current date type:

ctdbSetFieldDefaultDateTimeType(hField,ctdbGetFieldDefaultDateType(hField), CTIME_HMP);

  • Handle must be a field handle.
  • dateType is a date type format to be used for converting values between dates and strings. The possible values are:

    Value

    Symbolic Constant

    Explanation

    1

    CTDATE_MDCY

    Date format is mm/dd/ccyy

    2

    CTDATE_MDY

    Date format is mm/dd/yy

    3

    CTDATE_DMCY

    Date format is dd/mm/ccyy

    4

    CTDATE_DMY

    Date format is dd/mm/yy

    5

    CTDATE_CYMD

    Date format is ccyymmdd

    6

    CTDATE_YMD

    Date format is yymmdd

  • timeType is the time type to be used for converting values between time and strings. The possible values are:

    Value

    Symbolic Constant

    Explanation

    1

    CTTIME_HMSP

    Time format is hh:mm:ss am|pm

    2

    CTTIME_HMP

    Time format is hh:mm am|pm

    3

    CTTIME_HMS

    Time format is hh:mm:ss (24 hour)

    4

    CTTIME_HM

    Time format is hh:mm (24 hour)

    5

    CTTIME_MIL

    Time format is hhmm (military)

RETURN

Value

Symbolic Constant

Explanation

0

CTDBRET_OK

No error occurred.

See Appendix A for a complete listing of valid c-tree Plus error values.

EXAMPLE

/* set the field default date and time types */

hField = ctdbGetField(hTable, 5);

if (hField)

if (ctdbSetFieldDefaultDateTimeType(hField, CTDATE_DMY, CTIME_HMP))

printf("ctdbSetFieldDefaultDateTimeType failed\n");

SEE ALSO

ctdbSetFieldDefaultValue(), ctdbGetFieldDefaultValue(), ctdbClearFieldDefaultValue(), ctdbIsFieldDefaultValueSet(), ctdbClearAllFieldDefaultValue(), ctdbGetFieldDefaultDateType(), ctdbGetFieldDefaultTimeType()

TOCIndex