Skip to content

Toro Cloud Dev Center


examples package: Date parsing

The examples package includes services that demonstrate how to create Gloop date objects from a CharSequence, Number, or a java.util.Date object. As you will see in these Gloop examples, the process is as easy as mapping the source value to a GloopDate object by either using a map line or a set expression.

`GloopDate` property whose value has been set with a set expression

Related articles

Please see the following articles for more information:

Try it!

In the Navigator, expand the examples package and navigate to the code folder, then expand the dateManipulation package. This package contains four files, as shown below:

1
2
3
4
5
6
7
8
9
examples
├── ...
└── code
    ├── ...
    └── dateManipulation
        ├── CustomFormatToGloopDate.gloop
        ├── EpochSecondsToGloopDate.gloop
        ├── JavaDateToGloopDate.gloop
        └── StringToGloopDate.gloop

These services are named after the transformation they demonstrate. Open any of them and run them to see how GloopDate objects are created out of other object types. Line comments are present1 to help you understand these services better.

Explanation

Gloop will try its best to parse a given value using the built-in default DateCalendarConverter. In cases that the date value can't be converted, you can declare the format of the value to be parsed using the Date Formats property. A custom date format can be set by following the procedure below:

  1. Select a GloopDate object.
  2. In the Properties view, click the ellipsis button of the Date Formats property.

    `Date Formats` property

  3. This will open a dialog where you can enter the custom date formats (one per line). Once done, click OK.

    Date Formats dialog

Date formats

As you enter your date formats, Martini will populate the right-hand side of the dialog with the current date /time, using the format that's being entered.


  1. Open the service file to see comments. Make sure comments are also not hidden.