itshardtogetone wrote:
----- Original Message ----- From: "John W. Krahn" <[EMAIL PROTECTED]>

use Time::Local;

my $start = timegm 0,0,0,1,0,60;
my $end   = timegm 0,0,0,1,0,86;

print scalar gmtime $start + rand $end - $start;

Hi,
Thanks.
(1) But the above from time to time produce the following : - Use of uninitialized value in print at Untitled6 line 9 (which is here ==> print scalar gmtime $start + rand $end - $start;)

Try it using four digit years instead of two digit years:

my $start = timegm 0,0,0,1,0,1960;
my $end   = timegm 0,0,0,1,0,1986;

(2)  And what are these thing 0,0,0,1,0,60

perldoc -f localtime

Where can I read more about use Time::Local.

perldoc Time::Local

(3) What must I do if I dont want the time to be displayed. Only to display day, month and year.

$ perl -le'
use Time::Local;
use POSIX qw/strftime/;

my $start = timegm 0,0,0,1,0,1960;
my $end   = timegm 0,0,0,1,0,1986;

print strftime "%d %b %Y", gmtime $start + rand $end - $start;
'
01 Oct 1963



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to