How to set max bucket in canvas?

I want to count the number every second to get the maximum count.
So i'm trying to group by my_date_field.

SELECT SUBSTR(CONCAT(TO_CHAR(my_date_field)),4), COUNT(*) FROM "my_index_name" GROUP BY SUBSTR(CONCAT(TO_CHAR(my_date_field)),4)

but TO_CHAR is unknown function...
and i show like this..

my_date_field format is strict_date_time(yyy-MM-dd'T'HH:mm:ss.SSSZZ).

how can i set to get max records?