Re: Compare an integer to now() - interval '3 days'

From: Vibhor Kumar <vibhor(dot)kumar(at)enterprisedb(dot)com>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Compare an integer to now() - interval '3 days'
Date: 2011-03-11 13:46:02
Message-ID: 7774C058-7E17-4486-812C-915EDDA1EB8A@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Mar 11, 2011, at 6:44 PM, Alexander Farber wrote:

> from drupal_field_data_field_gender g, drupal_users u
> where g.field_gender_value='Robot' and
> u.uid=g.entity_id and u.created::timestamp > now() - interval '1 day';
> ERROR: cannot cast type integer to timestamp without time zone

Use to_timestamp function. For more detail refer following documentation:
http://www.postgresql.org/docs/8.3/static/functions-formatting.html

Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
vibhor(dot)kumar(at)enterprisedb(dot)com
Blog:http://vibhork.blogspot.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Igor Neyman 2011-03-11 14:55:48 Re: sort mem: size in RAM vs size on Disk
Previous Message Szymon Guz 2011-03-11 13:36:20 Re: Compare an integer to now() - interval '3 days'