From owner-freebsd-questions Mon Nov 19 1:37:54 2001 Delivered-To: freebsd-questions@freebsd.org Received: from gull.prod.itd.earthlink.net (gull.mail.pas.earthlink.net [207.217.120.84]) by hub.freebsd.org (Postfix) with ESMTP id 6A2C637B405 for ; Mon, 19 Nov 2001 01:37:51 -0800 (PST) Received: from dialup-209.245.132.171.dial1.sanjose1.level3.net ([209.245.132.171] helo=blossom.cjclark.org) by gull.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 165krt-00064W-00; Mon, 19 Nov 2001 01:37:50 -0800 Received: (from cjc@localhost) by blossom.cjclark.org (8.11.6/8.11.3) id fAJ9aPr82808; Mon, 19 Nov 2001 01:36:25 -0800 (PST) (envelope-from cjc) Date: Mon, 19 Nov 2001 01:36:14 -0800 From: "Crist J. Clark" To: Chris Aitken Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Epoch Time on Freebsd with perl Message-ID: <20011119013614.K69555@blossom.cjclark.org> Reply-To: cjclark@alum.mit.edu References: <5.1.0.14.2.20011119163225.01f5b130@mail.ideal.net.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <5.1.0.14.2.20011119163225.01f5b130@mail.ideal.net.au>; from chris@ideal.net.au on Mon, Nov 19, 2001 at 04:37:27PM +1100 X-URL: http://people.freebsd.org/~cjc/ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Nov 19, 2001 at 04:37:27PM +1100, Chris Aitken wrote: > Hi all, > > > Something im trying to play with is this. Im pulling 2 date/time variables > from a database, and what im trying to do is work out a comparison between > the both dates..... for example > > $date1 = "2001-10-01 01:00:00"; > $date2 = "2001-10-01 03:00:00"; > > What I want is to somehow calculate that there is 2 hours between these 2 > dates (or 120 minutes, or 7200 seconds etc etc) > > I know I can do a time() and it will return the number of seconds from > epoch, but it only works on live time, and I cant feed it a date and let it > calculate it on that. > > > Any help on this would be appreciated. $ man Time::Local -- Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message