The Loader is given the information below to update the offer with an OFFER_ID of 10123. The start date has a value of CURRENT TIMESTAMP, and the end date has a value of CURRENT TIMESTAMP + 14 DAYS.
<OFFER OFFER_ID="10123" STARTDATE="CURRENT TIMESTAMP"> ENDDATE="CURRENT TIMESTAMP + 14 DAYS" />
The Loader recognizes that the columns STARTDATE and ENDDATE are of a timestamp data type in the database. Based on the CurrentTimeStampLiteral property, the values are determined to have values specified in the current-timestamp format. The value for STARTDATE matches the InputCurrentTimeStampFormat.1 pattern, and it is converted to the pattern specified by the CurrentTimeStampFormat.JDBC property. The value for ENDDATE matches the format of the InputCurrentTimeStampFormat.2 property, and it is also converted to the pattern specified by the CurrentTimeStampFormat.JDBC property.
Examples of adding durations to current timestamps
The Loader gives you the ability to add durations to current timestamps. For example, you may want to load an offer without inputting a specific date. To do that, you must create an end date that is some duration after the start date. The following example works well with DB2:
<Offer Startdate="Current Timestamp" Enddate="Current Timestamp +14 Days +4 Months +1 Year +0 Hours +0 Minutes +0 Seconds" />
To handle current-timestamp durations in a platform-independent way, however, you must customize the current-timestamp formats by modifying the masks in the Loader customizer property file. Here is an example of customized current-timestamp property specifications:
CurrentTimestampLiteral=Current Timestamp InputCurrentTimestampFormat.0=Current Timestamp InputCurrentTimestampFormat.1=Current Timestamp %D Days InputCurrentTimestampFormat.2=Current Timestamp %M Months InputCurrentTimestampFormat.3=Current Timestamp %Y Years InputCurrentTimestampFormat.4=Current Timestamp %D Days %M Months InputCurrentTimestampFormat.5=Current Timestamp %D Days %M Months %Y Years InputCurrentTimestampFormat.5=Current Timestamp %H Hours %m Minutes %s Seconds CurrentTimestampFormat.JDBC=Current Timestamp %D Days %M Months %Y Years %H Hours %m Minutes %s Seconds
Using the offer example and these property specifications, the end date for the offer matches the InputCurrentTimestampFormat.5 pattern. This yields the following offer information using the CurrentTimestampFormat.JDBC.
<Offer Startdate="Current Timestamp" Enddate="Current Timestamp +14 Days +4 Months +1 Year +0 Hours +0 Minutes +0 Seconds" />
The preceding example shows how the Loader can input multiple current-timestamp formats and format them appropriately to a desired output format. The following example shows how you can handle platform-independent formats and map them to platform-specific output formats.
<Offer Startdate="Now" Enddate="Now +14D +4M +1Y" /> CurrentTimestampLiteral=Now InputCurrentTimestampFormat.0=Now InputCurrentTimestampFormat.1=Now %DD InputCurrentTimestampFormat.2=Now %MM InputCurrentTimestampFormat.3=Now %YY InputCurrentTimestampFormat.4=Now %DD %MM InputCurrentTimestampFormat.5=Now %DD %MM %YY InputCurrentTimestampFormat.5=Sysdate %HH %mm %ss CurrentTimestampFormat.JDBC=AddYears(AddMonths(AddDays(AddHours(AddMinutes(AddSeconds (Sysdate,%s),%m),%H),%D),%M),%Y)
Note: The above statement is just an example. It is used merely to illustrate the customization feature for a hypothetical database management system. It is not valid for DB2 or an Oracle database.
Using the offer example and these property specifications, the end date for the offer will match the InputCurrentTimestampFormat.5 pattern. This yields the following offer information using the CurrentTimestampFormat.JDBC.
<Offer Startdate="Current Timestamp" Enddate="AddYears(AddMonths(AddDays(AddMinutes(AddSeconds(Sysdate,0),0),0),14),4),1)" />