mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:37:45 +00:00
LibCore: Add %l conversion specification to DateTime
Replaced by the hour as a decimal 1-12 in which single digits are preceded by a blank
This commit is contained in:
parent
5c68ca8f48
commit
63d0aa9d8a
1 changed files with 7 additions and 0 deletions
|
@ -163,6 +163,13 @@ String DateTime::to_string(StringView format) const
|
|||
case 'j':
|
||||
builder.appendff("{:03}", tm.tm_yday + 1);
|
||||
break;
|
||||
case 'l': {
|
||||
int display_hour = tm.tm_hour % 12;
|
||||
if (display_hour == 0)
|
||||
display_hour = 12;
|
||||
builder.appendff("{:2}", display_hour);
|
||||
break;
|
||||
}
|
||||
case 'm':
|
||||
builder.appendff("{:02}", tm.tm_mon + 1);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue