Drupal's much-loved Date and Calendar modules are great for storing and displaying calendar-style dates, and can store "time of day" information for extra precision. If you're trying to store a different kind of time, though -- say, the length of a song or the number of minutes in a video -- the Date module is an awkward fit. That's where the HMS Field module comes in.Instead of storing an absolute date and time, HMS Field (short for 'Hours, minutes, and seconds') stores a simple integer representing a number of seconds. The field widget it ships with lets you enter a number like "5:45," while the field formatter allows you to display it in a similar style. There's not much to explain beyond that point -- HMS Field, as the Brits say, does what it says on the tin. It's easy to sort and filter Views based on the field's values, and writing custom display formatters for the field is relatively simple.The only downside to the module is the relatively limited display formatter it ships with. It's great for displaying the hours, minutes, and seconds that are stored, but it doesn't support natural language output like "10 minutes" or "4 hours." Even without those options, however, HMS Field is a great addition to any site builder's content-modeling toolbox.
Stay connected with our latest news, articles, webinars, and more via our newsletter.