Trimming the variable output

Hello,

Is there any way to trim the output of a variable with elasticsearch datasource?

I am getting the fields from elasticsearch as 2017-01-01T00:00:00.000Z. But I need the output as 2017. Please suggest any workaround or solution.