How Do I Format Dates Retrieved Using ODynaset (Oracle Objects For OLE)

From: <simonbeck_at_xwavesolutions.com>
Date: Wed, 20 Oct 1999 18:48:08 GMT
Message-ID: <7ul2p4$ihs$1_at_nnrp1.deja.com>



Hi,

In my Microsoft Visual C++ 6.0 MFC application I am using the Oracle Objects for OLE C++ Class Library to access an Oracle 8.1.5 database.

At one point, my application opens an ODynaset object, retrieving a row from a table using a simple select statement like this - "SELECT * FROM mytable WHERE my_primary_key = 123".

A number of columns in "mytable" are DATE columns. When I attempt to extract the retrieved value of one of mytable's DATE columns (using ODynaset's GetFieldValue(const char*, char*) method), the extracted date string has a 2-digit year, a very non-politically correct thing these days.

My question is this: How can I extract a retrieved DATE value out of an open ODynaset in such a way that the year is depicted using 4 digits? If possible, I would like to avoid having to change my SELECT statement.

Any and all help would be appreciated!

Thanks,
Simon

Here's a synopsis of my code (error checking excluded):

// Retrieve a row from the database.

ODynaset myDynaset;
myDynaset.Open(myDatabase, "SELECT * FROM mytable WHERE my_primary_key = 123");

// Extract a retrieved DATE value.

char stringBuffer[1024];
myDynaset.GetFieldValue((const char*)"date_created", (char*) stringBuffer);

// At this point, stringBuffer contains a non-Y2K compliant date
string, e.g., "10/14/99 1:06:56 PM"

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Oct 20 1999 - 20:48:08 CEST

Original text of this message