<!-- STEP 3. Add the article text.-->
Lately I've had to do a lot of work with
COleDateTime object variables.
They're pretty nice classes to work with but not when you're debugging and need to know
their actual date-time values. The
CTime class stores its value in a
COleDateTime uses the DATE type to keep its value. Unfortunately when we
need to know what they mean in human-readable format, such as 11/03/1999 14:08:56, it's
not possible without explicitly writing some code to format them into a string. Well, I
got tired of writing such code so instead I wrote a little application where I could
input the value I need to figure out and then have it converted at the click of a button.
The application is called DTConverter and its a simple MFC dialog-based application that
allows you to convert to and from a
DATE, or a regular string in
%m/%d/%Y %H:%M:%S format.
I hope it makes debugging your date-time objects less painful. Enjoy it!
Update by Geert Delmeiren
I use COleDateTimeSpan variables. These are also non-human readable,
so I extended the utility for converting COleDateTimeSpans also.
For converting a variable a couple of mouse clicks are needed:
- Ctrl-C to copy the variable's value
- Click on the utility's session in the task bar
- Click in the edit field you want to paste
- Ctrl-V to paste the value
- Click on the
That could be quicker! So I extended the utility with (configurable) auto-paste/auto-convert
functionality. In the fully automatic mode steps 3) to 5) are obsolete.
You just copy the value and activate the utility and... there's the result!
Another small change: The human readable date/time string now uses the format
specified in the regional settings.
22 Sep 2001 - added 'Always on Top' and disabling GUI logic to the dialogs.