Mike Lischke - points for your Dateformat solution

TA Mike.




neldAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LischkeCommented:
Hi neld.

here is the description from MSDN about DateTime_SetFormat, which is an official function call to modify a certain behaviour like the color or what else:

DateTime_SetFormat


Sets the display of a date and time picker (DTP) control based on a given format string. You can use this macro or send the DTM_SETFORMAT message explicitly.

void DateTime_SetFormat(
    HWND hwndDT,
    LPCTSTR lpszFormat);

Parameters
hwndDT
Handle to a DTP control.
lpszFormat
Address of a zero-terminated format string that defines the desired display. Setting this parameter to NULL will reset the control to the default format string for the current style.
Return Values
Returns nonzero if successful, or zero otherwise.

Remarks

It is acceptable to include extra characters within the format string to produce a more rich display. However, any nonformat characters must be enclosed within single quotes. For example, the format string "'Today is: 'hh':'m':'s ddddMMMdd', 'yyy" would produce output like "Today is: 04:22:31 Tuesday Mar 23, 1996".


Note A DTP control tracks locale changes when it is using the default format string. If you set a custom format string, it will not be updated in response to locale changes.

QuickInfo
  Version 4.70 and later of comctl32.dll

  Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 3.0 and later)...
  Windows 95/98: Requires Windows 98 (or Windows 95 with Internet Explorer 3.0 or later)..
  Windows CE: Requires version 2.0 or later.
  Header: Declared in commctrl.h.


Description of format strings:

A DTP format string consists of a series of elements that represent a particular piece of information and define its display format. The elements will be displayed in the order they appear in the format string.

Date and time format elements will be replaced by the actual date and time. They are defined by the following groups of characters:

Element Description  
"d"  The one- or two-digit day.
"dd"  The two-digit day. Single-digit day values are preceded by a zero.
"ddd"  The three-character weekday abbreviation.
"dddd"  The full weekday name.
"h"  The one- or two-digit hour in 12-hour format.
"hh"  The two-digit hour in 12-hour format. Single-digit values are preceded by a zero.
"H"  The one- or two-digit hour in 24-hour format.
"HH"  The two-digit hour in 24-hour format. Single-digit values are preceded by a zero.
"m"  The one- or two-digit minute.
"mm"  The two-digit minute. Single-digit values are preceded by a zero.
"M"  The one- or two-digit month number.
"MM"  The two-digit month number. Single-digit values are preceded by a zero.
"MMM"  The three-character month abbreviation.
"MMMM"  The full month name.
"t"  The one-letter AM/PM abbreviation (that is, AM is displayed as "A").
"tt"  The two-letter AM/PM abbreviation (that is, AM is displayed as "AM").
"yy"  The last two digits of the year (that is, 1996 would be displayed as "96").
"yyyy"  The full year (that is, 1996 would be displayed as "1996").

To make the information more readable, you can add body text to the format string by enclosing it in single quotes. Spaces and punctuation marks do not need to be quoted.

Note Nonformat characters that are not delimited by single quotes will result in unpredictable display by the DTP control.

For example, to display the current date with the format "'Today is: 04:22:31 Tuesday Mar 23, 1996", the format string is "'Today is: 'hh':'m':'s dddd MMM dd', 'yyyy". To include a single quote in your body text, use two consecutive single quotes. For example, "'Don''t forget' MMM dd',' yyyy" produces output that looks like: Don't forget Mar 23, 1996. It is not necessary to use quotes with the comma, so "'Don''t forget' MMM dd, yyyy" is also valid, and produces the same output.


Ciao, Mike
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
neldAuthor Commented:
Thanks Again !
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.