Click to See Complete Forum and Search --> : Convert character to date


irona20
March 20th, 2003, 07:42 AM
Hi!

If I use Oracle, I have to use: TO_DATE
And If I use SQL Server, I have to use: CONVERT

Is there any standard ODBC function to convert character to date?

Thank you in advance.

mikeecc
April 14th, 2003, 02:55 AM
Hi irona20,

Welcome to the wonderful world of database differences... Yes dates are a problem across different databases. It will depend on how you are trying to access the database.

We use Oracle, Sql Server and Access, and I had to write a function to return the correct format for the select statement based on the database it was going to run against.

I really don't think there is anyway around the problem. Good Luck to you. With my function I pass in the date and an integer which indicates the database type ( Oracle, Sql Server or Access ) and the function returns the correctly formatted string to be used for the database.


HTH
Mike