On 11-03-10 10:33 AM, newbie01 perl wrote:
#!/usr/bin/perl

#$today = localtime();
$today_epoch = time();
$today = localtime($today_epoch);

my @today = localtime( $today_epoch ); # When in list context, localtime returns an array that can be use with strftime

@date_fields = split(" ",$today);
$day=$date_fields[2];
$month=uc($date_fields[1]);
$year=$date_fields[4];

@time_fields = split(":",$date_fields[3]);
$hour=$time_fields[0];
$minute=$time_fields[1];
$second=$time_fields[2];

print "Today is ==>  $today \n";

print strftime( "%A\n", @today );
# etc.

See:
perldoc POSIX  and search for /strftime/
man strftime  or http://www.manpagez.com/man/3/strftime/


--
Just my 0.00000002 million dollars worth,
  Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software:  Fail early & often.

Eliminate software piracy:  use only FLOSS.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to