These modules define and format dates.
The Date Builder module converts a text string into a datetime value. You can pick a date using the handy built-in calendar widget, enter a text string into the module's entry field, or wire a string into it from another module, like the Text Input module.
Date Builder understands all the date formats as Date Input, formats like "tomorrow" and "3 days ago", as well as "07/04/2007" and "16:32 EST".
New output fields: day_name, day_ordinal_suffix, and month_name
This module is useful when you need to extract items from a feed by date. In this example, we'll use the U.S. CERT computer security Atom feed. This feed provides information on computer vulnerabilities reported in the last few months.
In our example, we want to return only very recent items, problems reported in the last five days.
We use a Fetch Feed module to grab the Atom feed (http://www.us-cert.gov/current/index.atom), and pipe it into a Filter module. We "permit items that match all of the following", and add a rule for the item.y:published.utime field. We'll filter if this value is greater than some value.
But what value? What we want is a utime value corresponding to five days ago. We can't just type "5 days ago" into the value field for the Filter rule -- that won't work. Instead, we add a Date Builder module and enter "5 days ago" into its Date field. Then we wire Date Builder into the Filter module's value field.
Because Date Builder outputs a datetime value, the Filter field recognizes it as such and converts to a drop-down list box. From this list we can select any of the datetime fields, including utime.
Now our feed only outputs items from the last five days.
This module formats a datetime value. A wide range of format specifiers can be used to create the output text string. The specifiers all begin with a percent sign followed by a single character.
Here are a few specifiers and how they each format the date/time February 12th, 2008 at 8:45 P.M.
|%A, %b %d, %y at %I:%M %p||Tuesday, Feb 12, 08 at 08:45 PM|
%K produces a RFC 822 compliant date (shortcut for “%a’,’ %d %b %G %H’:'%M’:'%S ‘GMT’”)
Timezone input field – which allows you to specify a target time zone. This must be one of the time zone IDs supported by the Java platform, or a custom time zone ID using the format defined in http://download.oracle.com/javase/6/docs/api/java/util/TimeZone.html
Here is a complete list of the format specifiers recognized by Date Formatter.
Different news feeds specify item publications dates in slightly different formats. Sometimes you need to match on a date, but need to format your date to match the quirks of the feed.
This example uses the Date Formatter and the Date Input module to determine the date corresponding to 9 years ago. The Pipe fetches data from the U.S. Geological Survey site and extracts a portion of the XML file using Fetch Data's Path to item list field.
Those items are then piped through a Filter module configured to match an XML element containing a year. That filter rule is wired to the Date Formatter module so that only those items matching our specified date (9 years ago) are sent to the Pipe Output.