Count days left

Hi comunity!
I am trying to make a counter that returns how many days are left until day ‘2025-01-26’
My query: SELECT CAST(‘2025-01-26’ AS DATE) - CURRENT_DATE is returning the days left correctly but it also has the time “268 00:00:00:000”.
I wanted to keep just the number of days “268”

I tried with DateDiff but it’s not supported. And I am choosing Athena as datasource.

Thank you in advance!

welcome @inesmariaanuncios

what if you used Standard Option and choose Misc → Number

image

I can only see that my query is returning this “268 00:00:00:000” because I am converting it to string:

If I keep the transformation use the Standard Option and choose Misc → Number nothing happens.
If I remove the transformation, being left with ‘No data’ nothing happens, too

how about

select cast(CAST('2025-01-26' AS DATE) - CURRENT_DATE as int)
1 Like

Nop :frowning:
‘TYPE_MISMATCH: line 1:8: Cannot cast interval day to second to integer’

1 Like

so, did you try datediff or date_diff

https://prestodb.io/docs/current/functions/datetime.html#date_diff

1 Like

Yes, I tried but I am using an Athena datasource and Athena does not recognize datediff function… I was trying to find a way using grafana to remove the last part of the string

1 Like

Solution: SELECT DAY(CAST(‘2025-01-26’ AS DATE) - CURRENT_DATE)
Thank you for the help @yosiasz

2 Likes