strftime: Added support for the %w format specifier.

This commit is contained in:
Fotis Panagiotopoulos 2022-10-18 16:29:41 +03:00 committed by Xiang Xiao
parent f9fd53cda1
commit ec93385dfa

View File

@ -130,6 +130,7 @@ static const char * const g_monthname[12] =
* %S The second as a decimal number (range 00 to 60). (The range is
* up to 60 to allow for occasional leap seconds.)
* %t A tab character. (SU)
* %w The weekday as a decimal number (range 0 to 6).
* %y The year as a decimal number without a century (range 00 to 99).
* %Y The year as a decimal number including the century.
* %% A literal '%' character.
@ -398,6 +399,14 @@ size_t strftime(FAR char *s, size_t max, FAR const char *format,
}
break;
/* %w: The weekday as a decimal number (range 0 to 6). */
case 'w':
{
len = snprintf(dest, chleft, "%d", tm->tm_wday);
}
break;
/* %y: The year as a decimal number without a century
* (range 00 to 99).
*/