1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:27:34 +00:00

LibCore: Add DateTime::to_string()

This is just the contents of to_deprecated_string() with errors
propagated. to_deprecated_string() is now implemented using to_string().
This commit is contained in:
Sam Atkins 2023-03-27 16:35:24 +01:00 committed by Sam Atkins
parent 7dfe1f9f8f
commit 8dd0038f47
2 changed files with 52 additions and 44 deletions

View file

@ -31,6 +31,7 @@ public:
bool is_leap_year() const;
void set_time(int year, int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0);
ErrorOr<String> to_string(StringView format = "%Y-%m-%d %H:%M:%S"sv) const;
DeprecatedString to_deprecated_string(StringView format = "%Y-%m-%d %H:%M:%S"sv) const;
static DateTime create(int year, int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0);