From: Samuel Kilchenmann Date: 2001-05-04T13:41:24+09:00 Subject: [ruby-talk:14617] Re: Question about Date "Eric Jacoboni" schrieb im Newsbeitrag news:863damdo06.fsf@titine.fr.eu.org... > > In Perl, i'm using Delta_DHMS to obtain the number of days of my > poor existence. Then i multiply by 86400, like this: > > =-=-=-= > #!/usr/bin/perl -w > > use Date::Calc qw/Delta_DHMS/; > > my @now = localtime; > my @diff = Delta_DHMS(1960,5,21,0,0,0, $now[5] + 1900, > $now[4] + 1, $now[3], $now[2], $now[1], $now[0]); > here you are including hour, minute, second of the current time in the difference. either change that line to $now[4] + 1, $now[3], 0, 0, 0); > > =-=-=-=-=-= > #!/usr/local/bin/ruby > > require "date2" > > my_birthdate = Date.new(1960, 05, 21) or include the HMS part in the ruby variant: t = Time.new() s = t.hour * 3600 + t.min * 60 + t.sec > printf "葡ic Jacoboni, born %d seconds ago.\n", \ > (Date.today() - my_birthdate) * 86400 (Date.today() - my_birthdate) * 86400 + s then you might get the same results from both scripts