Skip to main content

For joining tables by timestamp I need to round by the minute. I found date_trunc listed as supported function but can't get it to work.

 

update TABLE

set MATCH_TIME_START_MINUTES = date_trunc('minute', TIME_START);

 

gets me this:

 

Execution error: ERROR: Function date_trunc(unknown, varchar) does not exist, or permission is denied for date_trunc(unknown, varchar)

 

TABLE.TIME_START is converted with to_timestamp() before and then looks somewhat like

'2022-02-20 01:04:32'.

 

How can I "round_minute" in data jobs?

Try to convert to string, resticting to only minutes. Then convert back to timestamp

 

I think I did that once (not 100% sure)

 

HTH


Hi, Try this one might work,

DATE_TRUNC('MINUTE', TO_TIMESTAMP(TIME_START, 'YYYY-MM-DD HH:MI:SS'))


Reply