LOC_formatDate Function (ROM Call 0x590)

AMS 2.02 or higher system.h

void LOC_formatDate (const char *format, short y, short m, short d, char *date);

Formats a date into date according to format string.

format: string containing date specifiers:
D : One- or two-digit day of month.
DD : Two-digit day of month (leading zero if necessary).
M : One- or two-digit month.
MM : Two-digit month (leading zero if necessary).
YY : Two-digit year (year without century).
YYYY : Four-digit year.
Any other characters are copied to output.

y : Year.
m : Month.
d : Day of month.

Examples:

char date[16];
short y = 2000, m = 6, d = 9;
LOC_formatDate("M/D/YYYY", y, m, d, date);   // 6/9/2000
LOC_formatDate("MM/DD/YYYY", y, m, d, date); // 06/09/2000
LOC_formatDate("YYYY.MM.DD", y, m, d, date); // 2000.06.09
LOC_formatDate("D-M-YY", y, m, d, date);     // 9-6-00
LOC_formatDate("MM/YYYY", y, m, d, date);    // 06/2000

The ROM_CALL LOC_formatDate is available only on AMS 2.02 and higher.

Note: LOC_formatDate doesn't check the parameters, as you'll see if you try:
LOC_formatDate("MM/DD/YYYY",32767,32767,32767,buffer);
if buffer is large enough.


Uses: sprintf
Used by: LOC_localVersionDate


See also: LOC_getLocalDateFormat, LOC_localVersionDate