Comparison of DateTime items

Hi all,

I am using the Astro Binding and I have defined the following thing and item:

astro:sun:home  [ geolocation="00.000,00.000,100", interval=60 ]

DateTime         Daylight_Start       "Daylight [%1$tH:%1$tM]"                   { channel="astro:sun:home:daylight#start" }

The console shows the value of Daylight_Start in this format:
2019-06-04T05:24:00.000+0200

I have copied the following from the Astro Wiki:

if(now.isAfter((Daylight_Start.state as DateTimeType).zonedDateTime.timeInMillis))

But when the rule is triggered I get the error message:
“timeInMillis’ is not a member of 'java.time.ZonedDateTime”

The imports

import java.util.Calendar
import java.time.ZonedDateTime
import java.text.SimpleDateFormat
import java.util.Date

are apparently of no use:

“The import ‘java.util.Calendar’ is never used.
The import ‘java.util.Date’ is never used.
The import ‘java.time.ZonedDateTime’ is never used.
The import ‘java.text.SimpleDateFormat’ is never used.”

What’s wrong here?

Try toEpochMillis , no imports needed

if(now.isAfter((Daylight_Start.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli))

is doing the job.

Thank you.

I missed that part … old docs. See

Here is a thread which has several good resources for time comparison