Pb with Integer::parseInt in a rule

Hi,

I just want to get the integer part of a decimal number. Here is what I want to do with my test rule.

import java.lang.Math
import java.lang.Integer

var Number Display_Hour_Time

var Number Test

rule “Test”
when
Item Switch_test received command
then
Test = 19.82
Display_Hour_Time = (Integer::parseInt(Test))
sendXMPP(“xxxxxx@xxxxxxxx”,"Test: "+ Display_Hour_Time)
end

I get an exception like: Could not invoke method: java.lang.Integer.parseInt(java.lang.String,int) on instance: null

I search on the web and don’t find anything. Someone know what to do ?

Thank you,

Gilles.

Whilst I don’t know how to do what you want off the top of my head, I suspect the error is because parseInt expects you to pass it a string.

Hi Daniel,

Really sorry for my late answer.

I just want to convert a decimal time in “normal time”. like this:

19,5 => 19h30 min.

the decimal time is stored in an item.