Add docs/keywords/format.md
All checks were successful
GBCI / build (push) Successful in 10m6s

This commit is contained in:
rodriguez 2025-09-29 13:29:28 +00:00
parent 51a2141a00
commit cc7d00af45

55
docs/keywords/format.md Normal file
View file

@ -0,0 +1,55 @@
**FORMAT FUNCTION - PATTERN REFERENCE**
**SYNTAX:** `FORMAT(value, pattern)`
**PATTERN TABLE:**
| CATEGORY | PATTERN | OUTPUT EXAMPLE | DESCRIPTION |
|----------|---------|----------------|-------------|
| **DATE** | `yyyy` | 2024 | 4-digit year |
| | `yy` | 24 | 2-digit year |
| | `MM` | 01 | 2-digit month |
| | `M` | 1 | 1-2 digit month |
| | `dd` | 05 | 2-digit day |
| | `d` | 5 | 1-2 digit day |
| **TIME** | `HH` | 14 | 24-hour, 2-digit |
| | `H` | 14 | 24-hour, 1-2 digit |
| | `hh` | 02 | 12-hour, 2-digit |
| | `h` | 2 | 12-hour, 1-2 digit |
| | `mm` | 08 | 2-digit minutes |
| | `m` | 8 | 1-2 digit minutes |
| | `ss` | 09 | 2-digit seconds |
| | `s` | 9 | 1-2 digit seconds |
| | `tt` | PM | AM/PM designator |
| | `t` | P | A/P designator |
| | `fff` | 123 | Milliseconds |
| **CURRENCY** | `C` | $ | Currency symbol |
| | `c` | 123.45 | Currency amount |
| | `N` | 1,234.56 | Number with commas |
| | `n` | 1234.56 | Number without commas |
| | `F` | 123.00 | Fixed decimal |
| | `f` | 123.45 | Float decimal |
| | `0` | 0.00 | Zero placeholder |
| | `#` | #.## | Digit placeholder |
| **NUMERIC** | `0` | 0 | Required digit |
| | `#` | # | Optional digit |
| | `.` | . | Decimal point |
| | `,` | , | Thousands separator |
| | `%` | % | Percentage |
| **TEXT** | `@` | TEXT | Character placeholder |
| | `&` | text | Lowercase text |
| | `>` | TEXT | Uppercase text |
| | `<` | text | Force lowercase |
| | `!` | T | Force uppercase |
**COMMON COMBINATIONS:**
- `yyyy-MM-dd` → 2024-01-15
- `MM/dd/yy` → 01/15/24
- `HH:mm:ss` → 14:30:45
- `C0.00` → $123.45
- `N2` → 1,234.56
**USAGE:**
`FORMAT(123.456, "C2")` → "$123.46"
`FORMAT(NOW(), "yyyy-MM-dd HH:mm")` → "2024-01-15 14:30"
`FORMAT(0.15, "0%")` → "15%"