Skip to content

Commit

Permalink
Add info about date placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
Vankka committed Oct 7, 2023
1 parent b89f808 commit d561e37
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion docs/placeholders.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,51 @@ This same premise is used for all the re lookup placeholders.

---

# Misc
# Global placeholders
`%text:'<text>'"` - Returns arbitrary text. An example of a use case would be changing the placeholder to custom text if it is empty. For example `%player_prefix|text:'No Prefix'%`

# Date formatting
Some placeholders such as `log_time` for console lines take a time formatting string, for example: `ccc HH:mm:ss zzz` in `%log_time:'ccc HH:mm:ss zzz'%`

### (Useful) Formatting characters
| Symbol | Meaning | Examples |
|--------|----------------------------|------------------------------------------------|
| u | year | 2004; 04 |
| D | day-of-year | 189 |
| M/L | month-of-year | 7; 07; Jul; July; J |
| d | day-of-month | 10 |
| Q/q | quarter-of-year | 3; 03; Q3; 3rd quarter |
| Y | week-based-year | 1996; 96 |
| w | week-of-week-based-year | 27 |
| W | week-of-month | 4 |
| E | day-of-week | Tue; Tuesday; T |
| e/c | localized day-of-week | 2; 02; Tue; Tuesday; T |
| F | week-of-month | 3 |
| a | am-pm-of-day | PM |
| K | hour-of-am-pm (0-11) | 0 |
| H | hour-of-day | 0 |
| m | minute-of-hour | 30 |
| s | second-of-minute | 55 |
| S | fraction-of-second | 978 |
| V | time-zone ID | America/Los_Angeles; Z; -08:30 |
| z | time-zone name | Pacific Standard Time; PST |
| O | localized zone-offset | GMT+8; GMT+08:00; UTC-08:00; |
| X | zone-offset 'Z' for zero | Z; -08; -0830; -08:30; -083015; -08:30:15; |
| x | zone-offset | +0000; -08; -0830; -08:30; -083015; -08:30:15; |
| Z | zone-offset | +0000; -0800; -08:00; |
[Source](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html)

## Discord timestamp formatting
Example: `%log_time:'timestamp'%` or `%log_time:'timestamp:t'%`

### Styles
| Style | Meaning | Example |
|-------------|-----------------|------------------------------|
| t | Short Time | 16:20 |
| T | Long Time | 16:20:30 |
| d | Short Date | 20/04/2021 |
| D | Long Date | 20 April 2021 |
| f (default) | Short Date/Time | 20 April 2021 16:20 |
| F | Long Date/Time | Tuesday, 20 April 2021 16:20 |
| R | Relative Time | 2 months ago |
[Source](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles)

0 comments on commit d561e37

Please sign in to comment.