<item>.lastUpdate Date Formatting for print

Can someone clarify what format the timestamp returned by the .lastUpdate extension? I have the following rule working well to check for communication failures, but I cannot figure out how to format this date for display. (Using mysql for persistence)

rule "Item Comm Failure"
	when
		Time cron "0 0 8 1/1 * ? *" //Once Daily at 8:00 AM
	then
	    if (!<item>.updatedSince(now.minusSeconds(90))) {
			logInfo("ItemCommFailure", "Item Failure.  Time of last update is:  " + <item>.lastUpdate)
			sendTweet("Item Comm Failure.  Time of last update is:  " + <item>.lastUpdate)
		}
end

Could you show the string you are getting?
Using rrd4j I get something like:

19:40:16.970 [INFO ] [.eclipse.smarthome.model.script.Test] - E10_1.lastUpdate =2017-01-06T19:40:00.000+01:00

You are getting something different?

The string looks to be in the same format as yours.


2017-01-06 13:00:00.109 [INFO ] [se.smarthome.model.script.Irrigation] - Frontyard Irrigation Controller Comm Failure.  Time of last update is:  2017-01-05T21:26:40.000-06:00

The posted string sounds to me as Year 2017- Month01- Day 06 T Hour 19: Minute 40: Second00.000+01:00
What is your problem?

Sorry, I guess I wasn’t clear about what I’m trying to do. I want to be able to change the display format of this timestamp, I’d like to send and email or tweet that has a time stamp that is easier for a “normal” person to read. (eg. Last update was Friday January 6, 2017 at 01:20 pm).

I’ve got this figured out now. It seems that the missing link is to use .toDate.toString()

var String Timestamp = myItem.lastUpdate.toDateTime.toString("EEE MMM dd, yyyy hh:mm:ss a")
if (!FrontyardIPaddress.updatedSince(now.minusSeconds(90))) {
	logInfo("myItem", "Item Comm Failure.  Time of last update is:  " + Timestamp)
}

Gives me:

- Item Comm Failure.  Time of last update is:  Thu Jan 05, 2017 09:26:40 PM

I’m not sure if this is the best way, If there is a better way I’d love to hear it.