How to convert date to a single type in a Painless script?

It's required for
I need to access a date field in a Painless script, but I don't know what its type is.
I know there are at least two possible types - Long (epoch milliseconds) and JodaCompatibleZonedDateTime. Probably there are more.
So I need some way to convert date from one of possible types to a single type.
The method does similar thing, but it's not available inside a Painless script.

If there is no such functionality, I can try to add it.

I believe the concerns here have been addressed in (

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.