Reply to comment

Date time format bug (with fix)

There is a problem where the date and time are misformated if there is a large number of occurences in the log.
In my case 45,622
Below will dispaly your date and time regardless of the number of occurences.

Replace both sections of
#$IP = substr($_,8,16);
#$IP = trim($IP);
#$count = substr($_,27,4);
#$date = substr($_,33,10) if (substr($_,43,1) eq "-");
#$date = substr($_,33,11) if (substr($_,43,1) ne "-");
#$hour = substr($_,45) if (substr($_,44,1) eq "-");
#$hour = substr($_,44) if (substr($_,44,1) ne "-");
#$_ = $hour;
#s/-/:/;
#$hour = $_;
with
@values = split(':', $_);
$IP = trim($values[2]);
$count = trim($values[3]);
$datetime = trim($values[4] . ':' . $values[-2] . ':' . $values[-1]);
$date = substr($datetime,0,10);
$hour = substr($datetime,11,12);

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <b> <span> <pre> <hr>
  • Lines and paragraphs break automatically.
  • You may use [acidfree:xx] tags to display acidfree videos or images inline.
  • [l:URL text] input tags replaced with HTML links. URL may be Drupal internal path. [ Link Filter Tips ]

More information about formatting options