Solved

trouble shoot my counter date code...

Posted on 1998-01-13
1
950 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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

724 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