HOWTO: Format date/time values |
Post Reply |
Author | |
RichardJ
Newbie Joined: 11 April 2011 Status: Offline Points: 4 |
Post Options
Thanks(0)
Posted: 11 April 2011 at 9:31am |
I am adding some date/time values as CXTPReportRecordItemDateTime items and I would like to format the date and time string displayed in the cell. How do I do this? Using Column->SetFormatString() with a string such as "dd/MM/yyyy HH:mm:ss" (the value from GetLocaleInfo()) doesn't do the job. Product: Xtreme Toolkit Pro (MFC) version v15.0 |
|
mgampi
Senior Member Joined: 14 July 2003 Status: Offline Points: 1201 |
Post Options
Thanks(0)
|
Hi;
I do it this way:
I can't find a SetFormatString() function in CXTPReportColumn class?!?! |
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
RichardJ
Newbie Joined: 11 April 2011 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
Thanks for the answer. My mistake, SetFormatString() is on the item not the column. The documentation for the method is incorrect here. CXTPReportRecordItem::SetFormatString says to look at the sprintf format specifications whereas for CXTPReportRecordDateTimeItem::SetFormatString I should be looking at the strftime format specifications. The sprintf format specifications don't actually have any codes for dates or times. Unfortunately it looks like it's going to be tricky to use the user's/system preferences to do the formatting since this would require translating from one format specification to another. |
|
RichardJ
Newbie Joined: 11 April 2011 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
On further investigation, the formatting code %c respect's the user's settings.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |