Date and Time Picker Field

Description

This is an add-on for the Advanced Custom Fields WordPress plugin, that allows you to add a Date and Time Picker field type.

ACF PRO 5.0+ is no longer supported, ACF PRO has its own date and time picker

Compatibility

This add-on will work with:

  • Advanced Custom Fields version 4..
  • Advanced Custom Fields version 3 and bellow

More Information

http://soderlind.no/time-picker-field-for-advanced-custom-fields/

Screenshots

  • Add the Date and Time Picker field
  • Date and Time Picker
  • Time Picker

Installation

Plugin

  1. Copy the ‘acf-date_time_picker’ folder into your plugins folder
  2. Activate the plugin via the Plugins admin page

Include

  1. Copy the ‘acf-date_time_picker’ folder into your theme folder (can use sub folders). You can place the folder anywhere inside the ‘wp-content’ directory
  2. Edit your functions.php file and add the code below (Make sure the path is correct to include the acf-date_time_picker.php file)

    add_action(‘acf/register_fields’, ‘my_register_fields’);

    function my_register_fields()
    {
    include_once(‘acf-date_time_picker/acf-date_time_picker.php’);
    }

FAQ

Updating to ACF PRO

I got this quetion over at AWP on Facebook:

How does upgrading work? If someone starts with ACF and your plugin,
then upgrades to ACF Pro, will their date/time custom field disappear?
I understand the data will be maintained but wondering if the field
will still be visible in WP admin.

Updating to ACF PRO should work fine, ACF PRO has a compatibility add-on for this plugin, but test it on a non production environment first.

Also, read the comments on this issue: https://github.com/…/acf-field-date-time-picker/issues/103

How do I set the date and time format?

To set the date and time format when you create the field, you have to create a string using the letters below.

Date format

d day of month (no leading zero)
dd day of 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 year (no leading zero)
mm month of year (two digit)
M month name short
MM month name long
y year (two digit)
yy year (four digit)

Time format

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
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

Examples
  • yy-mm-dd: 2013-04-12
  • HH:mm: 24 hour clock, with a leading 0 for hour and minute
  • h:m tt: 12 hour clock with am/pm, no leading 0

How do I format the date and time when I want to use it in my theme?

The Date and Time Picker field is saved as an UNIX timestamp. Use the PHP date function when you use it in your theme.

Reviews

Cumbersome not mobile friendly

Functionality on desktop is fine but poor on mobile devices. Doesn’t function correctly in Contact 7. Kept being asked did I want to leave the page after saving. Affects other pages using datepicker.

Excellent

It appears in ACF menu, but it only allows to select date, not time. Doesn’t work.

UPDATE 2016-04-13: changed from 1-star to 5-star: it mysteriously started to work. But there were no plugin updates for the past 2 years. Anyway, it works now. Excellent.

Read all 16 reviews

Contributors & Developers

“Date and Time Picker Field” is open source software. The following people have contributed to this plugin.

Contributors

“Date and Time Picker Field” has been translated into 2 locales. Thank you to the translators for their contributions.

Translate “Date and Time Picker Field” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

2.1.5

  • Remove call to write_log() causing fatal error.

2.1.4

  • Fix for English Canadian locale which became Catalan, also fixes other en_*, fr_* and de_* locale.

2.1.3

  • Sorry, but 2.1.2 had unfinsihed code, please update to 2.1.3

2.1.2

  • Tested & found compatible with WP 4.7.

2.1.1

  • Tested & found compatible with WP 4.6.

2.1.0

2.0.18

2.0.17

  • Thanks to leocaseiro, Fix Backend Timestamp handling: render_field and Tested Up WordPress 4.0

2.0.16

  • Fix Undefined property: acf_field_date_time_picker::$domain

2.0.15

2.0.14

  • Added new languages/acf-field-date-time-picker.po file (note, renamed the language file)

2.0.13

  • Fixed compatibility bug with ACF 4.3.5
  • NOTE: 2.0.13 requires ACF 4.3.5 or later

2.0.12

  • Added support for date format dd/mm/yy
  • Bugfix

2.0.11

  • Added option to retrive field values, using the_field() and get_field(), as a timestamp

2.0.10

  • Removed “value” from defaults

2.0.9

  • Thanks to flahertydaf, the plugin in now working with the latest ACF version
  • Replaced DateTime::createFromFormat (PHP 5 >= 5.3.0), with strtotime
  • minor bugfixes

2.0.8

  • Adds option to store the date and time field as a UNIX timestamp or not.

2.0.7

  • Bug fix. 2.0.6 assumed that the stored date and time was in UNIX timestamp format. 2.0.7 will check and only convert if the date and time is.

2.0.6

  • Changed how the Date and Time Picker field is triggered when ACF adds a new Date and Time Picker field to the DOM
  • Saves the Date and Time Picker field as an UNIX timestamp to MySQL. Use the PHP date function when you use it in your theme.

2.0.5

  • When enqueuing JavaScripts, replaced dependecy of jquery-ui-datepicker with acf-datepicker

2.0.4

2.0.3

  • Fixed Repeater field bug
  • Added support for including the field in a theme

2.0.2

  • Updated readme.txt

2.0.1

  • Minor fix

2.0.0.beta

  • Total rewrite, based on the acf-field-type-template. Works with ACF v3 and ACF v4. In this beta you can only add the Date Time Picker field as a plugin (i.e. not as a template field).

1.2.0

  • Updated jquery-ui-timepicker-addon.js to the latest version (1.0.0) and added localization support.

1.1.1

  • Fixed a small bug

1.1

  • Change name to Date and Time Picker to reflect the new option to select between Date and Time picker or Time Picker only. Thanks to Wilfrid for point this out (not sure why I didn’t include it in 1.0)

1.0

  • Initial version