mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 16:12:07 +00:00
LibCore/DateTime: Add a helper for setting the time individually
This commit is contained in:
parent
8e77c72a5c
commit
251e5fb074
2 changed files with 6 additions and 0 deletions
|
@ -90,6 +90,11 @@ void DateTime::set_time(int year, int month, int day, int hour, int minute, int
|
|||
m_second = tm.tm_sec;
|
||||
}
|
||||
|
||||
void DateTime::set_time_only(int hour, int minute, Optional<int> second)
|
||||
{
|
||||
set_time(year(), month(), day(), hour, minute, second.has_value() ? second.release_value() : this->second());
|
||||
}
|
||||
|
||||
ErrorOr<String> DateTime::to_string(StringView format) const
|
||||
{
|
||||
struct tm tm;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue