>> select * from tutor_schedule where fk_tutor = 169 id | fk_tutor | time_start | time_end | schedule_type -----+----------+---------------------+---------------------+--------------- 288 | 169 | 2005-05-01 00:00:00 | 2005-05-01 01:00:00 | 1 289 | 169 | 2005-05-01 22:30:00 | 2005-05-02 01:00:00 | 1 (2 rows) >> select timezone.gmtoffset from timezone, person where person.id = 169 and timezone.id = person.fk_timezone gmtoffset ----------- 1 (1 row) >> select extract(dow from time_start), extract(hour from time_start), extract(minute from time_start), extract(dow from time_end), extract(hour from time_end), extract(minute from time_end), schedule_type from tutor_schedule where fk_tutor = 169 date_part | date_part | date_part | date_part | date_part | date_part | schedule_type -----------+-----------+-----------+-----------+-----------+-----------+--------------- 0 | 0 | 0 | 0 | 1 | 0 | 1 0 | 22 | 30 | 1 | 1 | 0 | 1 (2 rows)