sendNotification with time

Hi,
i want to send a notification to my android smartphone with OpenHab Android App.

sendNotification("abc@defg.hi", "*** Türklingel Haustür ***" +new DateTimeType)

This works, but i get a message with a bad formatted time.

*** Türklingel Haustür ***2017-11-02T13:35:20.051+0100

How can i do this a little bit more readable?

You can find your answer in the above URL.

So i need another variable where i store the datetime first?

Or can i do this directly in the sendnotification command without an extra variable declared?

This is not working:

sendNotification("abc@defg.hi", "*** Türklingel Haustür ***" +new DateTimeType.state.format("%1$td.%1$tm.%1$ty %1$tH:%1$tM"))

Try:

sendNotification("abc@defg.hi", "*** Türklingel Haustür ***" +new DateTimeType().format("%1$td.%1$tm.%1$ty %1$tH:%1$tM"))
4 Likes

Works great! Thank you!

1 Like