Skip to content

Commit

Permalink
LibWeb: Add documentation to the date parser format
Browse files Browse the repository at this point in the history
So we don't have to dig in the parser's code
  • Loading branch information
Arhcout authored and AtkinsSJ committed Jan 3, 2025
1 parent 5cfed45 commit aa82ff8
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Libraries/LibCore/DateTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,34 @@ class DateTime {
No,
};

// %a: require short day name
// %A: require long day name
// %h/b: require short month name
// %B: require long month name
// %C: require short year number (hundreds) (ex: 19 -> 1900)
// %d: require day number
// %D: require month number/day number/short year number (ex: 12/31/24)
// %e: require day number
// %H: require hour (24h format)
// %I: require hour (12h format)
// %j: require defining date with day number ? (not sure)
// %m: require set to month entred - 1
// %M: require minutes
// %n: require newline
// %t: require tab
// %r/p: require AM | PM
// %R: require hours:minutes (ex: 13:57)
// %S: require seconds
// %T: require hours:minutes:seconds (ex: 13:57:34)
// %w: require week day number
// %y: require 2 digits year (69 < year < 99: in the 1900 else in 2000)
// %Y: require full year
// %z: require timezone hours:minutes or single number to represent hour and minutes
// %x: require single number to represent hour and minutes
// %X: require sub second precision
// %Z: require timezone name
// %+: ignore until next '%'
// %%: require character '%'
ErrorOr<String> to_string(StringView format = "%Y-%m-%d %H:%M:%S"sv, LocalTime = LocalTime::Yes) const;
ByteString to_byte_string(StringView format = "%Y-%m-%d %H:%M:%S"sv, LocalTime = LocalTime::Yes) const;

Expand Down

0 comments on commit aa82ff8

Please sign in to comment.