Loading ...
Sorry, an error occurred while loading the content.

Re: adding date to form

Expand Messages
  • Damien Carbery
    #!/usr/local/bin/perl -w use strict; my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday ) = localtime(); $yday = sprintf( %02d:%02d:%02d %02d-%02d-%4d ,
    Message 1 of 13 , Apr 2, 2001
    • 0 Attachment
      #!/usr/local/bin/perl -w

      use strict;

      my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday ) =
      localtime();

      $yday = sprintf( "%02d:%02d:%02d %02d-%02d-%4d", $hour, $min,
      $sec, $mday, $mon, $year + 1900 );
      print $yday;

      __END__
      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.

      --- In perl-beginner@y..., Chanda Adams <adams@g...> wrote:
      >
      > is there a command that will simply add the date to a cgi script
      that will
      > be emailed? I know it's on the email, but in the form would be
      handy.
      >
      > Thanks!
      > Chanda
      >
      > --
      > Chanda Adams
      > adams@g...
    Your message has been successfully submitted and would be delivered to recipients shortly.