Re: comparring dates between perl and postgres

From: SaiHertz And Control Systems <sank89(at)sancharnet(dot)in>
To: hodges(at)xprt(dot)net
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: comparring dates between perl and postgres
Date: 2003-12-03 21:26:56
Message-ID: 3FCE5520.9030800@sancharnet.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message hodges 2003-12-03 22:24:38 Re: comparring dates between perl and postgres
Previous Message Frank Way 2003-12-03 20:32:21 Re: comparring dates between perl and postgres