develooper Front page | perl.beginners | Postings from January 2002

RE: return # of minutes since 5:00pm Jan 18, 2002 in perl on linux box

Thread Previous
From:
Wagner-David
Date:
January 31, 2002 15:34
Subject:
RE: return # of minutes since 5:00pm Jan 18, 2002 in perl on linux box
Message ID:
113A7A0D1F47D511B92E00D0B7E03DAB0187BAA1@pmail02.vikingfreight.com
	From windows, but just using std Perl functions:
use Time::Local;
	
    my $MyKnownDate = timelocal(0,0,17,18,0,102);
    printf "%-s\n", scalar(localtime($MyKnownDate)); 	# just reprinting so you know we are using the 								     	# right date
    my $MyCurrTime  = time;					# Current time
    my $MySecondsElapsed = $MyCurrTime - $MyKnownDate; # get seconds between now and then
    my $MyMinutes = $MySecondsElapsed/60;			 # get minutes
    printf "Elapsed: Seconds- %7.0f  Minutes: %7.1f\n", $MySecondsElapsed, $MyMinutes;
       
Output:

Fri Jan 18 17:00:00 2002
Elapsed: Seconds- 1117796  Minutes: 18629.9


Wags ;)
-----Original Message-----
From: KeN ClarK [mailto:ken@quantifier.org]
Sent: Thursday, January 31, 2002 15:11
To: beginners@perl.org
Subject: return # of minutes since 5:00pm Jan 18, 2002 in perl on linux
box


subject fairly sums it up. If I use localtime to get what time it is right 
now how can I determine the number of minutes between a KNOWN moment, such 
as above, and say, at the time the script is run? So far I have nothing 
and am perplexed...


_____________________________________
http://quantifier.org GnuPG: 7C828670
georef:    33:54:5.879N 83:19:16.824W
  6:00pm  up 20:08,  3 users
You're currently going through a difficult transition period called "Life."


-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About