How to format the persistence previousState().timestamp?

Hi all,

I cannot see the forrest for the trees. Have searched the forum up and down and saw plenty of posts but I wasn’t able to fix my issue :-/

Here is an extract from my rule:

logInfo("Test", TestSwitch.state.toString)
logInfo("Test", TestSwitch.previousState(true).state.toString)
logInfo("Test", TestSwitch.previousState(true).timestamp.toString)
logInfo("Test", TestSwitch.previousState(true).timestamp.time.toString)

Here the result:

2018-10-22 14:27:26.762 [INFO ] [.eclipse.smarthome.model.script.Test] - OFF
2018-10-22 14:27:26.794 [INFO ] [.eclipse.smarthome.model.script.Test] - ON
2018-10-22 14:27:26.818 [INFO ] [.eclipse.smarthome.model.script.Test] - 2018-10-22 14:25:17.0
2018-10-22 14:27:26.842 [INFO ] [.eclipse.smarthome.model.script.Test] - 1540211117000

How can I format the date value to something like dd.mm.yyyy?

best regards

Stefan

See:

In particular:

val String MyDateTimeString = MyDateTimeType_item.state.format("%1$td.%1$tm.%1$ty %1$tH:%1$tM"))