Re: comparring dates between perl and postgres
От | hodges@xprt.net |
---|---|
Тема | Re: comparring dates between perl and postgres |
Дата | |
Msg-id | 3FCDF226.29223.13384A6@localhost обсуждение исходный текст |
Ответ на | Re: comparring dates between perl and postgres (SaiHertz And Control Systems <sank89@sancharnet.in>) |
Ответы |
Re: comparring dates between perl and postgres
Re: comparring dates between perl and postgres |
Список | pgsql-novice |
I have never used extract. This generates a syntax error when I added and select extract( DOY FROM date) $sth = $dbh->prepare("SELECT date,address,time,host,direction,description, cal,reminder from firesides and select extract( DOY FROM date) where date > '$dstr1' and date <= '$dstr2'"); if ($sth->execute) { # assign each query record to an array $numrow = 0; while (($date,$address,$time,$host,$directions,$description,$cal,$reminder, $db_doy) = $sth->fetc\ hrow) Tom On 4 Dec 2003 at 2:56, SaiHertz And Control Systems wrote: > 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 dont know about perl but Postgresql will do it for you as > mypromt:#SELECT EXTRACT(DOY FROM DATE '2003-12-25') > date_part > ---------------------- > 359 > > 1 Row(s) affected > > Shoot back if this helps ! > > Regards, > V Kashyap > > > > >
В списке pgsql-novice по дате отправления: