| id | 95e11355-75c3-49e9-ab0e-5b1856b3837a | ||
|---|---|---|---|
| blueprint | modifiers | ||
| modifier_types |
|
||
| title | Format Time |
Given a time string, format_time will format it using PHP's datetime format variables.
start_time: 13:45::tabs
::tab antlers
{{ start_time | format_time }}
{{ start_time | format_time('g:ia') }}
{{ start_time | format_time('h:iA') }}::tab blade
{{ Statamic::modify($start_time)->format_time() }}
{{ Statamic::modify($start_time)->format_time('g:ia') }}
{{ Statamic::modify($start_time)->format_time('h:iA') }}::
1:45pm
1:45pm
01:45PMYou can technically use any date formatting variables, but only the time-related really ones make sense here.
| Value | Description | Example |
|---|---|---|
a |
Lowercase Ante meridiem and Post meridiem | am or pm |
A |
Uppercase Ante meridiem and Post meridiem | AM or PM |
g |
12-hour format of an hour without leading zeros | 1 to 12 |
G |
24-hour format of an hour without leading zeros | 0 to 23 |
h |
12-hour format of an hour with leading zeros | 01 to 12 |
H |
24-hour format of an hour with leading zeros | 00 to 23 |
i |
Minutes with leading zeros | 00 to 59 |
s |
Seconds with leading zeros | 00 to 59 |