cleanup, docs
This commit is contained in:
@@ -26,29 +26,10 @@ The formatter chooses one of three output formats:
|
||||
|
||||
The relative-time tokens available in all time formatters are:
|
||||
|
||||
```text
|
||||
%deltaS total elapsed seconds between the timestamp and now
|
||||
%deltaM total elapsed minutes between the timestamp and now
|
||||
%deltaH total elapsed hours between the timestamp and now
|
||||
%deltad total elapsed days between the timestamp and now
|
||||
%deltam total elapsed 30-day months between the timestamp and now
|
||||
%deltaY total elapsed 365-day years between the timestamp and now
|
||||
```
|
||||
|
||||
Default behavior examples:
|
||||
|
||||
```text
|
||||
time_format_relative(time() - 12)
|
||||
=> just now
|
||||
|
||||
time_format_relative(time() - 600)
|
||||
=> 10 minutes ago
|
||||
|
||||
time_format_relative(time() - 7200)
|
||||
=> 2 hours ago
|
||||
```
|
||||
|
||||
Related:
|
||||
|
||||
- PHP: `DateTimeImmutable` diff formatting or libraries such as Carbon `diffForHumans()`
|
||||
- JavaScript / Node.js: relative time helpers such as `Intl.RelativeTimeFormat`, `date-fns/formatDistanceToNow`, or Luxon
|
||||
:example
|
||||
print(time_format_relative(0, 0), "\n");
|
||||
|
||||
Reference in New Issue
Block a user