Skip site navigation (1) Skip section navigation (2)

Re: date comparison between perl and postgres

From: hodges(at)xprt(dot)net
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: date comparison between perl and postgres
Date: 2004-01-11 17:27:09
Message-ID: 400116ED.20153.2A0AE43@localhost (view raw or flat)
Thread:
Lists: pgsql-novice
To correct my self - that's month that needs to be padded
with the leading zero.

Tom

On 11 Jan 2004 at 9:18, hodges(at)xprt(dot)net wrote:

> It seems that perls local::time function returns the day 
> of the month as 1-31 whereas postgres returns it as 01-31.
> 
> I need to compare dates
> 
> if 2004-1-12 (from perl) less than 2004-01-19 (from postgres) and its failing.
> 
> Is there a way to have perl return day of the month as 
> a 2 digit string or some code to automaticly pad it?  
> I am using
> 
> # Get current time and date
> ($mday,$mon,$year)=(localtime(time + (24*60*60)))[3..5];
> $mon ++;
> $year +=1900;
> $dstr1 = "$year-$mon-$mday";
> 
> Thanks for any ideas,
> 
> Tom Hodges
> hodges(at)xprt(dot)net
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
> 



In response to

Responses

pgsql-novice by date

Next:From: small.witchDate: 2004-01-11 18:39:12
Subject: Alter TABLE with Postgres 7.2
Previous:From: hodgesDate: 2004-01-11 17:18:25
Subject: date comparison between perl and postgres

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group