At 12:00am -0700 01-04-26, Palm Developer Forum digest wrote:
>Subject: DateTemplateToAscii Sample Code?
>From: "Jim Garozzo" <[EMAIL PROTECTED]>
>Date: Wed, 25 Apr 2001 13:28:22 -0500
>X-Message-Number: 49
>
>Has anyone use this function?? If so, I was wondering if can see how
>someone has utilized this function. It's new for SDK 3.5 and am new too!
>I'm real curious how a person would call this function and use the results.
It's most useful when you're doing special things with dates, versus
just getting the user prefs settings for the date format and then
passing that to DateToAscii.
For example, if you need the short name of the 12th month ("Dec" for
the US locale), then you could call:
Char buffer[dateStringLength+1];
DateTemplateToAscii("^2r", december, 0, 0, bufffer, sizeof(buffer));
or if you wanted to get the abbreviation for Wednesday ("W" for the
US locale) then you could call:
DateTemplateToAscii("^1s", april, 25, 2001, buffer, sizeof(buffer));
since 4/25/2001 is a Wednesday. Obviously this could be used in a
loop to get each day of week name, starting from Sunday.
Or if you needed to format a date in the ISO standard ("2001-04-26")
you could do that with:
Char buffer[11];
DateTemplateToAscii("^4l-^3z-^0z", month, day, year, buffer, 11);
-- Ken
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/