raghu rajendran
raghu rajendran

Reputation: 80

how to compare two timestamp fields without seconds in postgresql?

Expected : I want to comapre these two dates without seconds. Eg

  1. '2011-12-30 09:55:56', '2011-12-30 08:55:55' comparison of these two should return TRUE.

  2. '2011-12-30 09:55:56', '2011-12-30 08:54:55' comparison of these two should return FALSE.

Upvotes: 1

Views: 1970

Answers (1)

user330315
user330315

Reputation:

Use date_trunc() and "round" the values to minutes:

date_trunc('minute', timestamp '2011-12-30 08:55:56') = date_trunc('minute', timestamp '2011-12-30 08:55:55')

Upvotes: 7

Related Questions