How do i set a local time in php?

Alfred H

New member
This is the code I use to log IP adresses. How can I set it so it logs the local time?

Note: I don't much about php.

<?php
$ip = $_SERVER['REMOTE_ADDR'];
$date = date('m.d.y g:i a');
$file = fopen('test.txt', "a");
fwrite($file, "IP: $ip \n");
fwrite($file, "Date: $date \n
");
fclose($file);
?>
 
Back
Top