The Format: Date Mapper allows users to map dates in any format that the PHP datetime supports. This way, it is possible to map the date, i.e., 021822 to 18-02-2022. Apart from that, it is also possible to map the datetime value by input, such as tomorrow or -3 days.
Please refer to https://www.php.net/manual/datetime.formats.php for available formats and https://www.php.net/manual/timezones.php for available time zones.
In this guide, we will provide a sample of how you can use this mapper.
Use Case
Format a value as a date
- Add a new Value mapper.
- Configure the accessor to access the attribute to the value that you want to map.
- Add a new mapper and choose Format: Date.
- Here you will get some fields to fill in.
- Output format (required). The output datetime format of the mapping.
- Input format. The date instance will be created based on the datetime format of the input value.
- Output timezone. The output datetime time zone of the mapping.
- Input timezone. The date instance will be created based on the datetime time zone of the input value.
Create new date
- Create a new Value setter.
- Fill in the name of the new Key.
- Choose string as a config value, then you can leave the Value field blank if you want to get the current time, or you can modify the Value field as your need, e.g., “-3days”.
- Add a new mapper and choose Format: Date
- Here you will get some fields to fill in.
- Output format (required). The output datetime format of the mapping.
- Output timezone. The output datetime time zone of the mapping.