Well, deprecation is just a warning so for the short run you can just ignore it.
I’m not seeing that warning but I’m on an older build of the snapshot. The method is not marked as deprecated in the JavaDoc, aha, but I see now it is marked as deprecated in the code.
Looks like they switched from using a regular old Date to a ZonedDateTime object.
So use:
(Sunset.state as DateTimeType).toEpochSecond * 1000
to get the same behavior without the deprecation warnings.
Let me know if that works, it is all theoretical since I can’t try it on my system.