summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore/DateTime.cpp
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2022-04-12 18:00:10 -0600
committerTim Flynn <trflynn89@pm.me>2022-04-15 08:24:20 -0400
commitb2ef7ee53172599e874c24e1efbf61e0ac0f4a40 (patch)
treead6e86f7cd5bd8f88288a0ba7e69b8d5e943c003 /Userland/Libraries/LibCore/DateTime.cpp
parent0500d49acb132f57a4bb4e5a8e7b86e9c7d61710 (diff)
downloadserenity-b2ef7ee53172599e874c24e1efbf61e0ac0f4a40.zip
LibC+LibCore: Change a.m./p.m. to AM/PM
Diffstat (limited to 'Userland/Libraries/LibCore/DateTime.cpp')
-rw-r--r--Userland/Libraries/LibCore/DateTime.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Userland/Libraries/LibCore/DateTime.cpp b/Userland/Libraries/LibCore/DateTime.cpp
index 479c433dfa..0f3530f375 100644
--- a/Userland/Libraries/LibCore/DateTime.cpp
+++ b/Userland/Libraries/LibCore/DateTime.cpp
@@ -173,13 +173,13 @@ String DateTime::to_string(StringView format) const
builder.append('\n');
break;
case 'p':
- builder.append(tm.tm_hour < 12 ? "a.m." : "p.m.");
+ builder.append(tm.tm_hour < 12 ? "AM" : "PM");
break;
case 'r': {
int display_hour = tm.tm_hour % 12;
if (display_hour == 0)
display_hour = 12;
- builder.appendff("{:02}:{:02}:{:02} {}", display_hour, tm.tm_min, tm.tm_sec, tm.tm_hour < 12 ? "a.m." : "p.m.");
+ builder.appendff("{:02}:{:02}:{:02} {}", display_hour, tm.tm_min, tm.tm_sec, tm.tm_hour < 12 ? "AM" : "PM");
break;
}
case 'R':
@@ -427,19 +427,19 @@ Optional<DateTime> DateTime::parse(StringView format, String const& string)
}
break;
case 'p': {
- auto ampm = string.substring_view(string_pos, 4);
- if (ampm == "p.m." && tm.tm_hour < 12) {
+ auto ampm = string.substring_view(string_pos, 2);
+ if (ampm == "PM" && tm.tm_hour < 12) {
tm.tm_hour += 12;
}
- string_pos += 4;
+ string_pos += 2;
break;
}
case 'r': {
- auto ampm = string.substring_view(string_pos, 4);
- if (ampm == "p.m." && tm.tm_hour < 12) {
+ auto ampm = string.substring_view(string_pos, 2);
+ if (ampm == "PM" && tm.tm_hour < 12) {
tm.tm_hour += 12;
}
- string_pos += 4;
+ string_pos += 2;
break;
}
case 'R': {