postgresql copy comand with date in filename
You have to use dynamic SQL, for example with a DO statement:
DO
$$DECLARE
   datestr text := to_char(current_timestamp, 'YYYY-MM-DD-HH24_MI_SS');
BEGIN
   EXECUTE format(
              'COPY '
              '(SELECT * FROM mytable) '
              'TO %L CSV HEADER',
              'C:\Users\me\mylocation\' || datestr || '.csv'
           );
END;$$;