InputfieldTime by Netcarver

Adds a fieldtype and Inputfield for MySQL TIME fields.

FieldtypeTime & InputfieldTime

Modules for ProcessWire that allow easy input of times in various formats. The value is stored in the DB as an SQL time field with values between about +800:00:00 and -800:00:00 but the display and input format can be chosen by the user.

Supported Input/Display formats


The following input and display formats are supported.

  • 'HH24' Hours (0-24)
  • 'HH24MM' Hours (0-24) & minutes (00-59)
  • 'HH24MMSS' Hours (0-24), minutes (00-59) & seconds (00-59)
  • 'HHH' Hours (Integer 0-800)
  • 'HHHMM' Hours (0-800) & minutes (00-59)
  • 'HHHMMSS' Hours (0-800), minutes (00-59) & seconds (00-59)
  • 'MMM' Minutes (Integer)
  • 'SSS' Seconds (Integer)
  • 'MMSS' Minutes (00-59) & seconds (00-59).

The fieldtype will use the chosen format to work out if actual input is incomplete and try to autocomplete the missing parts. For example, if you have a field setup to HH24MM and only type '9' into the Inputfield the fieldtype will assume you mean '09:00' (that is, 9 in the morning) and use that as the final value.

You can configure if colons are to be used between parts in the displayed output. So you can choose between '0900' and '09:00'.

Comparison in selectors


If you wish to use a formatted time in a selector then you need to have the time in your selector string use the DB formatting of 'HH:MM:SS' as the comparison is done by the DB. You can use the date() function directly or you can use the utility function formattedStringToTime()...

// For a value with Hours and Mins...
$selector_time_string = date('H:m:00', $time); // or...
$selector_time_string = FieldtypeTime::formattedStringToTime(date('H:m', $time), 'HH24MM');

It will often be easier to work with date() directly.

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Twitter updates

  • This week ProcessWire 3.0.214 is on the dev branch. Relative to 3.0.213 this version has 16 new commits which include the addition of 3 new pull requests, 6 issue fixes, a new WireNumberTools utility class, and various other improvements. More
    17 March 2023
  • ProcessWire 3.0.213 core updates: This week we’ll look at the new WireSitemapXML module, a new WireNumberTools core class, and a new ability for Fieldtype modules to specify useful ready-to-use configurations when creating new fields. More
    24 February 2023
  • ProcessWire 3.0.212 core updates— More
    17 February 2023

Latest news

  • ProcessWire Weekly #463
    In the 463rd issue of ProcessWire Weekly brings we'll check out the latest weekly update from Ryan, some weekly forum and online highlights, and more. Read on!
    Weekly.pw / 26 March 2023
  • ProcessWire 3.0.213 core updates
    This week we’ll look at the new WireSitemapXML module, a new WireNumberTools core class, and a new ability for Fieldtype modules to specify useful ready-to-use configurations when creating new fields.
    Blog / 24 February 2023
  • Subscribe to weekly ProcessWire news

“Indeed, if ProcessWire can be considered as a CMS in its own right, it also offers all the advantages of a CMF (Content Management Framework). Unlike other solutions, the programmer is not forced to follow the proposed model and can integrate his/her ways of doing things.” —Guy Verville, Spiria Digital Inc.