When you cast a feed's element value to the date data type, MashupHub converts the element's string value into a datetime type by matching the string format to one of the default sets of datetime formats.
Datetime values are converted into the time zone of the Java™ Virtual Machine (JVM) that MashupHub is running on. The JVM can be set to a time zone that is different from the computer.
The following lists show the default date formats that are supported by the data mashup builder.
mm/dd/yyyy hh:mm:ss am/pm
The time component is supported. Supported fields include minutes, seconds, and a case-insensitive AM/PM flag. Time fields are optional. If the AM/PM flag is present, the time is based on a 12-hour clock. If the AM/PM flag is not present, the time is based on the 24-hour clock. Following are example dates that MashupHub automatically loads:
03/02/08 12:23:54 AM
3/2/08 4:00 pm
ISO 8601 formats (includes Atom)
The parts of the ISO date formats are:
The year, shown in 4 digits. For example: 2008.MM
The month, shown in 2 digits. For example the month of April would appear as 04. If the month is not provided, the default is the first month of the year (01).dd
The day, shown in 2 digits. For example the ninth day would appear as 09. If the day is not provided, the default is the first day of the month (01).T
Designates the start of the time component of the datetime representation. If the time is not provided, the default is 00:00:00.000.HH
The hour, shown in 2 digits. For example 1 o'clock in the afternoon would appear as 13. If the hour is not provided, the default is 00.mm
The minute, shown in 2 digits. For example 15. If the minute is not provided, the default is 00.ss
The seconds, shown in 2 digits. For example 49. If the seconds are not provided, the default is 00.SSS
The milliseconds, shown in 3 digits. For example 555. If the milliseconds are not provided, the default is 000.Z
The designation for the Zulu time zone, which is the military and aviation designation for Greenwich Mean Time (GMT).
With ISO 8601, the time zone can also be expressed as a plus (+) or as a minus (-) offset from the Coordinated Universal Time (UTC) or GMT. For example: 2008-04-13T17:25:55.123-08:00. If the time zone is not provided, the default is the time zone of the JVM on which MashupHub is running.
Following are examples of valid formats for Atom feeds:
RFC 822 formats (used by RSS)
MashupHub supports RSS, which conforms to RFC 822:
EEE, dd MMM yyyy HH:mm:ssZ
The parts of the RSS date formats are:
Optional: The day of the week. For example, Wed.dd
The day, shown in 1 or 2 digits. For example, the ninth day can appear as 09 or as 9.MMM
The month, shown in 3 letters. For example, the month of April appears as APR.yy or yyyy
The year, shown in either 2 or 4 digits. For example either 08 or 2008.HH
Optional: The hour, shown in 2 digits. For example 7 o'clock in the morning would appear as 07.mm
Optional: The minutes, shown in 2 digits. For example 15.ss
Optional: The seconds, shown in 2 digits. For example 49.Z or z
Time zone indicator. The time zone can be expressed as a plus (+) or as a minus (-) offset from the Coordinated Universal Time (UTC) or GMT, or as a specific time zone designation such as PST. The indicators GMT, UT and Z are Coordinated Universal Time. For example: Wed, 30 Apr 2008 10:10:55 -0800 or Wed, 30 Apr 2008 13:10:55 EST.
Following are example RSS dates
Sun, 02 Mar 2008 00:01:00 UT
Sun, 2 Mar 08 00:01:00 GMT
Sun, 2 Mar 2008 00:01:00 -0000
2 Mar 08 00:01:00 -0000
2 Mar 2008 00:01 -0000
Although the RSS format requires the time and the time zone, MashupHub also supports only the date. For example:
Custom numeric datetime formats
If the datetime format in a feed is not one of the default formats, you can use the Create DateTime function to convert an external string value that is in a supported format into an internal datetime data type. You can then use the Format DateTime function to specify a date and time representation supported in a specific country for the output. You can also use the Format Date function to format the date portion only.
Following is the list of the supported datetime numeric formats that you can select in the Transform operator "Choose Function" window for the Format Type
value. The example date is March 14, 2001 at 1:30:55 in the afternoon.
14-03-2001 13:30:55 (colon separator in the time)
14-03-2001 13.30.55 (period separator in the time)
14/03/2001 13:30:55 (colon separator in the time)
14/03/2001 13.30.55 (period separator in the time)
Specifying the time zone in the input value is not supported for the numeric formats. The default time zone is the time zone of the JVM on which MashupHub is installed.
The numeric datetime formats have the following characteristics.
Table 1. Characteristics for date and time fields for supported numeric datetime formats
|Date field||The month and day can be 1 or 2 digits.|
The year can 2 or 4 digits. For example:
The day is optional. If the day is not set, it is initialized to 1. For example:
|Date output is fixed length: 2 digits for the month, 2 digits for the day, and 4 digits for year. For example:|
|Time field (optional)||The hour is variable-length, 1 or 2 digits. |
Minutes and seconds are fixed length, 2 digits each.
Hours, minutes, and seconds are optional. If they are not set, they are initialized to 0.
Input recognizes the AM/PM flags, for example:
|Time output is fixed length: 2 digits for the hour, 2 digits for the minutes, and 2 digits for the seconds.|
Only the 24-hour clock is supported. For example:
UNIX datetime format
If the datetime format in a feed is not one of the default formats, you can use the Create DateTime function to convert an external string value that is in a supported format into an internal MashupHub datetime data type. You can then use the Format DateTime function to specify the UNIX® datetime format for the output. You can also use the Format Date function to format the date portion only.
The UNIX option supports the UNIX timestamp, also called UNIX epoch time, which is the number of seconds since January 1, 1970, in Coordinated Universal Time (UTC).
For example, if you create a new datetime from a UNIX timestamp of 1228089600
, then format it as Atom, the UTC result is 2008-12-01T00:00:00.000+00:00
. However, the time displayed on your system depends on the time zone of the JVM on which the MashupHub server is installed. In New York the result for 1228089600
will be 2008-11-30T19:00:00.000-05:00
, and in Los Angeles the result will be 2008-11-30T16:00:00.000-08:00
. If you choose UNIX for the output format, the resulting UNIX timestamp is always in UTC.
Parent topic: Builtin functions: imc3
Casting data type values: imc3