Display the Opportunities Closed This Month
Example: Display Opportunities Closed This Month
Suppose that you want to see which opportunities closed this month. Your data includes the account name, the close date fields, and the epoch seconds field.

Use date() to generate the close date in date format. Then use relative date ranges to filter opportunities closed in the current month.
q = load "OpsDates1";
q = filter q by date(’CloseDate_Year’, ‘CloseDate_Month’, ‘CloseDate_Day’) in ["current month" .. "current month"];
q = foreach q generate Account;
If the query is run in May 2018, the resulting data stream contains one entry:
To add the close date in a readable format, use toDate().
q = load "OpsDates1";
q = filter q by date('CloseDate_Year', 'CloseDate_Month', 'CloseDate_Day') in ["current month" .. "current month"];
q = foreach q generate Account, toDate('CloseDate_sec_epoch') as 'Close Date';
The resulting data stream includes the full date and time of the close date.

You can also display just the month and day of the close date.
q = load "OpsDates1";
q = filter q by date('CloseDate_Year', 'CloseDate_Month', 'CloseDate_Day') in ["current month" .. "current month"];
q = foreach q generate Account, 'CloseDate_Month' + "/" + 'CloseDate_Day' as 'Close Date';
The resulting data stream contains the month and day of the close date.