Owntracks, MQTT and JSON script

Im struggling with that binding, specially with the JSON transformation. I cant receive the timestamp out of mqttMatthiasLastUpdated with that mqttitude-tstamp.js. (it`s located in the transform folder)

I tried all scripts I found but none of them work.

//var location = eval('(' + input + ')');
//var tz = 5*3600000 //timezone offset in milliseconds (5 is Eastern)
//var cal = new Date((location.tst*1000) - tz);
//var t = cal.toISOString();
//result = t;

//var location = eval('(' + input + ')');
//var myDate = new Date (location.tst * 1000);
//result = myDate.toLocaleString();

//var location = eval('(' + input + ')');
//var cal = new java.util.GregorianCalendar();
//var t = new org.openhab.core.library.types.DateTimeType(cal);
//var t = new org.eclipse.smarthome.core.library.types.DateTimeType(cal);
//result = t;

(function(json){ var otdata = JSON.parse(json); 
var this_date = new Date(otdata.tst * 1000);
this_date.setHours(this_date.getHours() - 1);
return this_date.toISOString();

these are my items:

//Owntracks/mqttitude Binding
String  Matthias    "Matthias [%s]"     <Matthias>       (gPresenceChart,gDashboard)
Switch  phone_Matthias      "Matthias@dahoam [MAP(presence.map):%s]"   <present>       (gPresence,gPhones)  {mqttitude="broker:owntracks/openhabian/phone_Matthias/event:dahoam"}									              
Switch  phone_Matthias_Work "Matthias@IBM_Office [MAP(presence_work.map):%s]" <ecu>   { mqttitude="broker:owntracks/openhabian/phone_Matthias/event:arbeit" }

//MQTT Binding
String  mqttPositionMatthiasRaw     "Matthias's Raw Data [%s]"  { mqtt="<[broker:owntracks/openhabian/phone_Matthias:state:default]" }
DateTime        mqttMatthiasLastUpdated     "Matthias zuletzt gemeldet [%1$tm/%1$td/%1$tY %1$tH:%1$tM:%1$tS]"      <clock> { mqtt="<[ broker:owntracks/openhabian/phone_Matthias:state:JS(mqttitude-tstamp.js)]" }
Location        locationMatthias
String  mqttMatthiasLatitude        
String  mqttMatthiasLongitude       
String  mqttMatthiasAccuracy        "GPS Genauigkeit [%s m]"
String  mqttMatthiasBattery "Matthias's Handy Battery [%s%%]" <battery>       (Phone,MQTT,Battery)
Switch Matthias_moving "Notify on motion" <siren>
Number MatthiasDistanceFromHome "Entfernung von zuhause [%.3f km]"
2018-04-26 20:07:32.675 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type JS
2018-04-26 20:07:32.681 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn't post update for 'mqttMatthiasLastUpdated'
2018-04-26 20:07:32.704 [vent.ItemStateChangedEvent] - mqttPositionMatthiasRaw changed from {"_type":"location","tid":"2","acc":16,"batt":80,"conn":"w","lat":47.9611636,"lon":13.2425069,"tst":1524766032} to {"_type":"location","tid":"2","acc":16,"batt":80,"conn":"w","lat":47.9611636,"lon":13.2425069,"t":"u","tst":1524766033}

another question regarding the offsite time. what is the correct offset for the austrian timezone please (UTC+2)

thanks for help…

You haven’t installed the JS transformation add-on.

thanks Rich, you we`re right.
it works now with that script:

(function(json){ var otdata = JSON.parse(json); 
var this_date = new Date(otdata.tst * 1000);
this_date.setHours(this_date.getHours() + 2); //2 is offsite for timezone (UTC+2)
return this_date.toISOString();

found out how to offset the correct timezone, added a comment for others.