Given 2 timestamps in postgres, how do you calculate the time difference without counting whole Saturdays and Sundays?
OR
How do you count the number of Satu
You might find this really helpful:
CREATE OR REPLACE FUNCTION working_days(date, date) RETURNS INT AS $$ SELECT COUNT(days)::INT FROM generate_series($1, $2, '1 day') AS days WHERE EXTRACT(DOW FROM days) NOT IN(0, 6); $$ LANGUAGE 'sql' IMMUTABLE STRICT;