Обсуждение: Problem in date function

Поиск
Список
Период
Сортировка

Problem in date function

От
"Ramesh Patel"
Дата:
dear All

I am use Trigger in my database  . In This  trigger i want to add months
in date.
date and  no of month come from insert query mean NEW.dt or NEW.months

new date = NEW.dt + NEW.months

I dont know how to add month in a date in trigger.

Please help me


Ramesh Patel
System Dept.
Banasdairy, Palanpur(B.K.)
E-Mail : ramesh@banasdairy.coop
Mobile : 94263 91295


Re: Problem in date function

От
"Jason Minion"
Дата:
Assuming your New.dt is a date type and NEW.months is an integer, you
probably want to change your expression to something like:

NEW.dt + (NEW.months * INTERVAL '1 month')

Also a good read:

http://www.postgresql.org/docs/8.1/interactive/functions-datetime.html


Jason Minion

-----Original Message-----
From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Ramesh Patel
Sent: Tuesday, February 28, 2006 1:37 AM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] Problem in date function

dear All

I am use Trigger in my database  . In This  trigger i want to add months
in date.
date and  no of month come from insert query mean NEW.dt or NEW.months

new date = NEW.dt + NEW.months

I dont know how to add month in a date in trigger.

Please help me


Ramesh Patel
System Dept.
Banasdairy, Palanpur(B.K.)
E-Mail : ramesh@banasdairy.coop
Mobile : 94263 91295


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org