I have some issue while formatting a timestamp with Amazon Athena service.
select date_format(current_timestamp, 'y')
Returns just 'y' (the string).
The only way I found to format dates in Amazon Athena is trough CONCAT
+ YEAR
+ MONTH
+ DAY
functions, like this:
select CONCAT(cast(year(current_timestamp) as varchar), '_', cast(day(current_timestamp) as varchar))
select current_timestamp
,date_format (current_timestamp, '%Y_%m_%d')
,format_datetime (current_timestamp, 'y_M_d')
;
+---------------------+------------+-----------+
| _col0 | _col1 | _col2 |
+---------------------+------------+-----------+
| 2017-05-19 14:46:12 | 2017_05_19 | 2017_5_19 |
+---------------------+------------+-----------+