Solved

trouble shoot my counter date code...

Posted on 1998-01-13
1
949 Views
Last Modified: 2013-12-25
This is from a script I got which was made for UNIX, but I'm running on my NT 4.0 with perl 5 installed.

# This section is the main log

$PRINT = "Content-type:\ text/plain\n\n ";
$shortdate = `date +"%D %T %Z"`;
chop ($shortdate);
       {
         $PRINT;
      
      open (MAINLOG, ">>$mainlog");
      print MAINLOG "Time: $shortdate\n";
      print MAINLOG "User: $ENV{'REMOTE_USER'}\n";
      print MAINLOG "Host: $ENV{'REMOTE_HOST'}\n";
      print MAINLOG "Addr: $ENV{'REMOTE_ADDR'}\n";
      print MAINLOG "With: $ENV{'HTTP_USER_AGENT'}\n";
      print MAINLOG "Page: $ENV{'HTTP_FROM'}\n";
      print MAINLOG "From: $ENV{'HTTP_REFERER'}\n\n";
      close (MAINLOG);
}

The main.log file indicates that it is having trouble getting the date, as seen excerpted below:

Time: The system cannot accept the date entered.
Enter the new date: (mm-dd-yy) The system cannot accept the date entered.
Enter the new date: (mm-dd-yy) The system cannot accept the date entered.
Enter the new date: (mm-dd-yy)
User:
Host:
Addr:
With:
Page:
From:

What do i do to modify this so it can run on my NT machine?
0
Comment
Question by:retroman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
paul_t earned 20 total points
ID: 1831824
'date' command for NT performs different way than for UNIX,
so you shall replace:

$shortdate = `date +"%D %T %Z"`;

with:

$shortdate = `date /T`;

or (preferable)

$shortdate = localtime;

or you may display any part of time you'l want if
splitting localtime to parts with the help of:

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

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question