ODBC - Date and Time

Card Puncher Data Processing

About

You have several options when dealing with dates and times using ODBC:

  • Default ODBC Date formatting
  • Specific SQL function
  • ANSI date format
  • Default database date format

Options

Default ODBC Date formatting

You can use the default ODBC Date formatting:

#03-DEC-81#

Which is the style that DAO/Jet will use by default.

Specific SQL function

You can use a SQL function if you are directly executing a SQL statement to encapsulate whatever date format you want. For example with the TO_DATE() Oracle function:

 
SELECT TO_CHAR(sysdate,'MM/DD/YYYY') FROM dual

This will be brought over then as a character string containing the date format you specified.

ANSI date format

You can use an ANSI date format via an ODBC escape:

{ d '1981-12-03' }

Note that this is enclosed in single quotes and always of the format YYYY-MMDD.

Database default date format

You can always use the database standard date format in much the same way.

Example for Oracle:

{ '03-Dec-1981' }

Time may be specified as follows:

{ t 'hh:mm:ss' }

A timestamp (date including time) can be done with the following format:

{ ts '1981-12-03 00:00:00' }





Discover More
Card Puncher Data Processing
ODBC - Grammar

ODBC reference - Scalar Functions T-SQL...
Card Puncher Data Processing
ODBC - Open Database Connectivity

In computing, Open Database Connectivity (ODBC) provides a standard software API method for using database management systems (DBMS). The designers of ODBC aimed to make it independent of programming languages,...
Time - Time representation (Moment, Instant)

This section goes over the representation of time in a scalar way versus in a collection way (ie time series) Time is basically a numeric counter that increases over time. An instant in time can be represented...



Share this page:
Follow us:
Task Runner