
The Date / Time field can store a date and time value in various formats.
Contents
Quick Start
- Fill out the Basic Field Settings (Label, Description, and Field Name)
- Select Field Type: Date / Time.
- Click Save New Field (or Save Field if you’re updating an existing field) to save your field configuration.
Settings
- Date Format Type
The options available are:- WordPress default
- Predefined format
- Date Format (predefined)
You can choose the predefined format you want to display the date as. The options available for date formatting are:- 10/08/2008
- 10-08-2008
- 10.08.2008
- 2008/10/08
- 2008-10-08
- 2008.10.08
- October 8, 2008
- October 8th, 2008
- 2008-10-08T11:37:22-05:00
- 08/10/2008
- 08-10-2008
- 08.10.2008
- 08/Oct/2008
- 08-Oct-2008
- Date Format (predefined)
- Custom format
- Date Format for Display
Enter a custom date format to use. - Date Format for Input
Enter a custom JS date format to use.
- Date Format for Display
- Time Format Type
The options available are:- WordPress default
- 12 hour
- Time Format (12 hour)
The options available for time format (12 hour) are:- 11:37 AM
- 11:37:22 AM
- 11:37 AM
- 11:37:22 AM
- 11:37am
- 11:37am
- 11:37
- 11:37:22
- 11:37
- 11:37:22
- Time Format (12 hour)
- 24 hour
- Time Format (24 hour)
The options available for time format (24 hour) are:- 11:37 AM
- 11:37:22 AM
- Time Format (24 hour)
- Custom
- Time Format for Display
Enter a custom time format to use. - Time Format for Input
Enter a custom JS time format to use.
- Time Format for Display
- Year Range
Enter a year range to restrict the date within. - Allow empty value
When enabled, this will allow an empty value to be saved. Otherwise, the current date/time will be used. - Enable HTML5 Input Field
When enabled, this will render the field withtype="datetime"
using the default browser interface. Based on your needs, the browser interface may be a better experience especially for mobile devices. For more details on HTML5 types, you can read the documentation at W3 on Validating Common Input.
Custom PHP Date / Time Formats
Pods supports the PHP standard formats for Date and Time for custom display formatting.
Custom JS Date Formats for Input
Prior to Pods 2.8, we supported custom JS date formats from jQuery UI Datepicker. We no longer use jQuery inputs for fields, however we will continue to support the formats below.
Format | Label |
---|---|
d | Day of the Month (No Leading Zero) |
dd | Day of the Month (Two Digit) |
o | Day of the Year (No Leading Zeros) |
oo | Day of the Year (Three Digit) |
D | Day name (Short) |
DD | Day name (Long) |
m | Month of the Year (No Leading Zero) |
mm | Month of the Year (Two Digit) |
M | Month name (Short) |
MM | Month name (Long) |
y | Year (Two Digit) |
Custom JS Time Formats for Input
Prior to Pods 2.8, we supported custom JS time formats from jQuery UI Timepicker. We no longer use jQuery inputs for fields, however we will continue to support the formats below.
Format | Label |
---|---|
H | Hour with no leading 0 (24 hour) |
HH | Hour with leading 0 (24 hour) |
h | Hour with no leading 0 (12 hour) |
hh | Hour with leading 0 (12 hour) |
m | Minute with no leading 0 |
mm | Minute with leading 0 |
s | Second with no leading 0 |
ss | Second with leading 0 |
l | Milliseconds always with leading 0 |
c | Microseconds always with leading 0 |
t | a or p for am/pm |
T | A or P for AM/PM |
tt | am or pm for am/pm |
TT | AM or PM for AM/PM |
z | Timezone |
Z | Timezone in Iso 8601 format (+04:45) |
Year Range Format
Prior to Pods 2.8, we supported yearRange
formats from jQuery UI Datepicker. We no longer use jQuery inputs for fields, however we will continue to support the formats below.
Format | Example | Label |
---|---|---|
-nn:+nn | -5:+5 | Relative to today’s year |
c-nn:c+nn | c-5:c+5 | Relative to the currently selected year |
nnnn:nnnn | 2008:2021 | Absolute year range |
nnnn:-nn | 2008:-5 | Combinations of the supported formats |
How to Display
Display with a Shortcode
[pods field="my_date_time_field"]
Display with PHP: pods_field_display()
<?php echo pods_field_display( 'my_date_time_field' );
Display with PHP: $pod->display()
<?php $pod = pods(); echo $pod->display( 'my_date_time_field' );