Re: [PBML] Re: adding date to form
- Damien Carbery <daymobrew@...>
: #!/usr/local/bin/perl -w
: use strict;
: my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday ) =
: $yday = sprintf( "%02d:%02d:%02d %02d-%02d-%4d", $hour, $min,
: $sec, $mday, $mon, $year + 1900 );
: print $yday;
: I know the call to localtime() could be simplified.
: I used sprintf() because I read it is more efficient than printf but,
: of course, I can't find where I read this.
: Now you have the info, you can print it with your CGI/HTML output
: as normal.
localtime is already set up for a default date and time string:
print scalar localtime;
my $date = localtime;
Mon Apr 2 15:49:26 2001 on my win98 system.
Charles K. Clarkson
There's no better way to scare students
away from computers than exposing them to Perl.