OH2 - Rule does not work any more: The name 'TimeZone' cannot be resolved to an item or type;

I migrated from OH1 to OH2

I have a Problem with some Rules, one is:

rule "Letztes Lebenszeichen: PIR-Sensor OG Flur"
when Item OG_PIR_FLUR_HELLIGKEIT received update or
	 Item OG_PIR_FLUR_MOTION changed
then OG_PIR_FLUR_LAST_PING.postUpdate(new DateTimeType(java::util::Calendar::getInstance(TimeZone::getTimeZone("Europe/Berlin"))))
end

Item-File:

DateTime OG_PIR_FLUR_LAST_PING			"PIR OG Flur: Letzter Ping [%1$td.%1$tm. %1$tT]" <calendar> 	(debugPIR, pingPIR)

worked fine with OH1.

OH2 now throws an error: The name ‘TimeZone’ cannot be resolved to an item or type;

What’s the correct usage for getting actual timestamp to store it as datetime item?

Thanks for your hints in advance!
Florian

You could try

rule "Letztes Lebenszeichen: PIR-Sensor OG Flur"
when Item OG_PIR_FLUR_HELLIGKEIT received update or
	 Item OG_PIR_FLUR_MOTION changed
then OG_PIR_FLUR_LAST_PING.postUpdate(new DateTime.now())
end

Thanks for your reply.
your solutions gives another error:

Rule 'Letztes Lebenszeichen: (...)': An error occurred during the script execution: null

OK, seemed to be quite simple.

OG_PIR_FLUR_LAST_PING.postUpdate(now.toString())

did it… :wink: