mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:27:45 +00:00
LibCore: Add a way to parse a DateTime from a string
DateTime can now be parsed from a string. Implements the same formatters as strptime: https://linux.die.net/man/3/strptime (Well, some of them at least).
This commit is contained in:
parent
cbd7437d40
commit
904322e754
2 changed files with 282 additions and 0 deletions
|
@ -35,6 +35,7 @@ public:
|
|||
static DateTime create(unsigned year, unsigned month = 1, unsigned day = 0, unsigned hour = 0, unsigned minute = 0, unsigned second = 0);
|
||||
static DateTime now();
|
||||
static DateTime from_timestamp(time_t);
|
||||
static Optional<DateTime> parse(const String& format, const String& string);
|
||||
|
||||
bool operator<(const DateTime& other) const { return m_timestamp < other.m_timestamp; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue