From: | hodges(at)xprt(dot)net |
---|---|
To: | SaiHertz And Control Systems <sank89(at)sancharnet(dot)in>, pgsql-novice(at)postgresql(dot)org |
Subject: | Re: comparring dates between perl and postgres |
Date: | 2003-12-03 22:24:38 |
Message-ID: | 3FCDF226.29223.13384A6@localhost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)xprt(dot)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
>
>
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Sai Hertz And Control Systems | 2003-12-03 23:24:27 | Re: comparring dates between perl and postgres |
Previous Message | SaiHertz And Control Systems | 2003-12-03 21:26:56 | Re: comparring dates between perl and postgres |