0 Replies - 1458 Views - Last Post: 18 October 2007 - 08:22 AM

#1 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6819
  • View blog
  • Posts: 31,418
  • Joined: 10-May 07

current date for a logfile

Posted 18 October 2007 - 08:22 AM

Description: Construct the current date for a logfile
($Second, $Minute, $Hour, $Day, $Month, $Year) = localtime(time);
$Month = $Month + 1; # Increment month by 1.
$LongYear = $Year + 1900; # Set $LongYear.
if($Year >= 100) {
	$Year = $Year - 100; # Decrement year by 100.
}
$Day = sprintf("%02d",$Day);
$Month = sprintf("%02d",$Month);
$Year = sprintf("%02d",$Year);
$Hour = sprintf("%02d",$Hour);
$Minute = sprintf("%02d",$Minute);
$Second = sprintf("%02d",$Second);

$currentDate = $Year . $Month . $Day;
$archiveDate = $LongYear . $Month . $Day;
$currentTime = "$Hour$Minute$Second";

$logmessage = "$archiveDate : $currentTime : even started";

print $logmessage; # send this to a log file


Is This A Good Question/Topic? 0
  • +

Page 1 of 1