Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - How to change DateTime item's format?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to change DateTime item's format?

 Post Reply Post Reply
Author
Message
d324 View Drop Down
Groupie
Groupie


Joined: 16 April 2007
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote d324 Quote  Post ReplyReply Direct Link To This Post Topic: How to change DateTime item's format?
    Posted: 24 June 2007 at 10:49am
Hi,

I'm using CXTPReportRecordItemDateTime in a report control to show a date
for each record. The default shows something like "Fri Jun/22/2007 12:45 PM".
Is there anyway to change the format?

Thanks.
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 26 June 2007 at 10:39am
Hi;
 
I derived from CXTPReportRecordItemDateTime and did it like this:

CXRReportRecordItemDateTime::CXRReportRecordItemDateTime(
const COleDateTime& dt) : CXTPReportRecordItemDateTime(dt)
{
SetFormatString(_T(""));
}

CString CXRReportRecordItemDateTime::GetCaption(CXTPReportColumn* /*pColumn*/)

{
if (!m_strCaption.IsEmpty())
return m_strCaption;

if (m_odtValue.GetStatus()==COleDateTime::invalid)

return _T("");

else

return m_odtValue.Format();

}

Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 06 July 2007 at 4:39pm
You can do it easier: SetFormatString actually set the format string according to rules of COleDateTime::Format method.

--
WBR,
Serge
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.125 seconds.