• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 699
  • Last Modified:

How to convert datetime field within a C++ program.

How do I convert a datetime field to a string (and string to datetime) form a c++ program.  Assuming I'm using the OLE-DB "DBTIMESTAMP" datatype, how do I convert to a string and back?
Is the "IDataConvert::DataConvert()  method the easiest way?
0
Finch
Asked:
Finch
1 Solution
 
simonsmiCommented:
How are you getting the data out of the database. If you are using ODBC then you should be reading the datetime field in a CTime object and you can then use standard C++ operations to format this into a string and vice-versa. Similarly for OLE DB, the data should being read into a DBTIMESTAMP type which can be formatted into a string in C++.

.... or are you getting the data using another method?
0
 
FinchAuthor Commented:
Edited text of question.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now