Re: comparring dates between perl and postgres

Поиск
Список
Период
Сортировка
От Frank Way
Тема Re: comparring dates between perl and postgres
Дата
Msg-id 20031203203221.83287.qmail@web11608.mail.yahoo.com
обсуждение исходный текст
Ответ на comparring dates between perl and postgres  (hodges@xprt.net)
Список pgsql-novice
If you are using the Perl Date::Calc module (available from CPAN) you
should be able to plug the year, month, day fields (that you can fairly
easily extract from the date returned by PostgreSQL) into the
Day_of_Year function and get what you want.

Hope this helps,
Frank Way


--- hodges@xprt.net wrote:
> I am getting a field of date type from PostgreSQL and an
> integer that is a number of days (1 to 3).
>
> select date, num_days from table
> $date, $num_days
>
> In my perl script I am getting the current date
>
> #find current date
> ($mday,$mon,$year,$doy)=(localtime(time))[3..5,7];
> $mon ++;
> $year +=1900;
> $today = "$year-$mon-$mday";
>
> I need to test whether $date from PostgreSQL matches
> $today + $num_days.
>
> Can perl extract day of year ($doy) from the Postgres date?
>
> Is there a better way to do this?
>
> Thanks,
> Tom Hodges
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
majordomo@postgresql.org


=====
Frank Way
E-Mail: fgw_three@yahoo.com

"Place guards on all the roads and keep the troops
from running to the rear..." MG John Buford, 1863

__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

В списке pgsql-novice по дате отправления:

Предыдущее
От: hodges@xprt.net
Дата:
Сообщение: comparring dates between perl and postgres
Следующее
От: SaiHertz And Control Systems
Дата:
Сообщение: Re: comparring dates between perl and postgres