Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Find last complete hour using time now


Find last complete hour using time now

New Contributor


I'm trying to find the last 1 months worth of data. I need to send my API two dates, the dateFrom and the dateTo.

I have this code so far that I found on this forum:

${now() :minus(${now():mod(86400000)}) :minus(2592000000) :format('MM-dd-yyyy hh:mm:ss') }
${now() :minus(${now():mod(86400000)}) :format('MM-dd-yyyy hh:mm:ss') }

Which gives this:

from 2019-05-08 01:00:00 
to  2019-06-07 T01:00:00

What I am confused about it is always shows me 01:00:00 as the time. What I actually want is the last full hour. So if we are at 08:34:54 I want it to show me 08:00:00, so I am always making a complete hourly query. Is there a way to do this?

Don't have an account?
Coming from Hortonworks? Activate your account here