date_to_string(DateTime | DateOnly, format)

Converts a date to a string.

This function takes a DateTime, DateOnly, or now() as its first argument. For the allowed formats, see the Date Formats section in Date Formats.

Use date_to_string() to display the close date for your opportunities in the format yyyy-MM-dd.. CloseDate must be a DateTime or DateOnly type.

q = foreach q generate date_to_string('CloseDate', "yyyy-MM-dd") as 'Close Date';

If CloseDate is a Date type, convert it to a DateOnly type with toDate().

q = foreach q generate date_to_string(toDate('CloseDate', "yyyy-MM-dd"), "yyyy-MM-dd") as 'Close Date';