Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - How to set date time format
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to set date time format

 Post Reply Post Reply
Author
Message
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post Topic: How to set date time format
    Posted: 31 May 2008 at 8:24pm
Hi
 
I can see that the report control uses a CXTPReportControlLocale object to set date time formats for CXTPReportRecordItemDateTime items
 
But how can I change the date time format itself?
 
Why no SetDateTimeFormat(LPCSTR strFormat) function?
 
It's not using the system or user locale formats.  Neither long nor short date nor time.  At least it's not showing the format I see in Control Panel->Regional Settings.
 
So I can only assume it's using a hard-coded format string?
 
It's very confusing, and documentation is very sparse on this topic.
Back to Top
adrien View Drop Down
Senior Member
Senior Member


Joined: 30 April 2007
Location: New Zealand
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote adrien Quote  Post ReplyReply Direct Link To This Post Posted: 31 May 2008 at 8:26pm
I just found it uses m_strFormatString....
 
which is set in CXTPReportRecordItem::SetFormatString
 
but this isn't mentioned anywhere in the docs.
 
Also, since it's a member string, how do I set it to NULL?  It needs to be NULL to use locale settings...
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 645
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Posted: 07 July 2008 at 2:14am
I think a suggestion would be to overwrite the SetFormatString (in this case a bad name) to use the OleDateTime formatting like: LANG_USER_DEFAULT and DATEVALUEONLY etc..
 
Most often users would prefer the local settings of Windows (?). And for some reason it is rather complex to convert the OleDateTime formatting strings to the Windows Date Time formatting strings and vise versa.
 
Another way is to use the %x and %X formatting, and then maybe play around with the setlocale(LC_ALL,"").
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.