DBDate(Object, Int32) Method

Create database compliant date, time or datetime string from excel date type value
Namespace: DBaddinAssembly: DBaddin in (DBaddin.dll)

Syntax

public static string DBDate(
	object DatePart,
	int formatting
	)

Parameters

DatePart
Type: Object
date/time/datetime single parameter or range reference
formatting
Type: Int32
formatting instruction for Date format, see remarks

Returns

String
the DB compliant formatted date/time/datetime

Remarks

formatting = 0: A simple date string (format 'YYYYMMDD'), datetime values are converted to 'YYYYMMDD HH:MM:SS' and time values are converted to 'HH:MM:SS'. formatting = 1: An ANSI compliant Date string (format date 'YYYY-MM-DD'), datetime values are converted to 'YYYY-MM-DD HH:MM:SS' and time values are converted to 'HH:MM:SS'. formatting = 2: An ODBC compliant Date string (format {d 'YYYY-MM-DD'}), datetime values are converted to {ts 'YYYY-MM-DD HH:MM:SS'} and time values are converted to {t 'HH:MM:SS'}. formatting = 3: An Access/JetDB compliant Date string (format #YYYY-MM-DD#), datetime values are converted to #YYYY-MM-DD HH:MM:SS# and time values are converted to #HH:MM:SS#. add 10 to formatting to include fractions of a second (1000) formatting >13 or empty (99=default value): take the formatting option from setting DefaultDBDateFormatting (0 if not given)