date


Define a Date.

Oddjob's inbuilt conversion allows a date to be specified as text in any of these formats:

yyyy-MM-dd
Just the date.
yyyy-MM-dd HH:mm
The date, hours and minutes.
yyyy-MM-dd HH:mm:ss
The date, hours, minutes and seconds.
yyyy-MM-dd HH:mm:ss.SSS
The date, hours, minutes, seconds and milliseconds.

Because of this a date property of a job can be specified perfectly easily as a value or a property. However there are two situations when this is inadequate:

In either or both of these cases the date type can be used.

This date type can also be used to specify a java Calendar property which Oddjob's inbuilt conversion will currently not do from text.


Property Summary

date A date in text, if a format is specified it is expected to be in the format provide, otherwise it is expected to be in the default format..
format The format the date is in.
timeZone The time zone the date is for.

Example Summary

Example 1 A simple example of specifying a date.
Example 2 Specifying a date in a different format.
Example 3 Adjusting a date by Time Zone.

Property Detail

date

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredYes.

A date in text, if a format is specified it is expected to be in the format provide, otherwise it is expected to be in the default format..

format

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The format the date is in.

timeZone

Configured ByATTRIBUTE
AccessREAD_WRITE
RequiredNo.

The time zone the date is for.


Examples

Example 1

A simple example of specifying a date.

<date date="2009-12-25 12:30"/>

Example 2

Specifying a date in a different format.

<date date="25/12/2009 12:30" format="dd/MM/yyyy HH:mm"/>

Example 3

Adjusting a date by Time Zone.

<sequential>
            <jobs>
                <variables id="vars">
                    <xmas>
                        <date timeZone="US/Hawaii" date="2009-12-25"/>
                    </xmas>
                </variables>
                <echo>Christmas in Hawaii starts at ${vars.xmas}.</echo>
            </jobs>
        </sequential>


(c) Rob Gordon 2005 - 2011