LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to get date in guestbook (php) (https://www.linuxquestions.org/questions/programming-9/how-to-get-date-in-guestbook-php-44096/)

CurlyMo 02-04-2003 04:21 PM

How to get date in guestbook (php)
 
I have a php guestbook and i want to record the date and time that a user is posting. I came this far:

$date_format = date("d-m-'y G:i");
if ($Pointer) {
fwrite ($Pointer, "<?PHP\n");
fwrite ($Pointer, "\$id = $id;\n\$pg = $pg;\n");
for ($indx = 1; $indx <= $id; $indx++) {
if ($e["$indx"]["n"]) {
$e["$indx"]["n"] = ereg_replace("\\\'","'",$e["$indx"]["n"]);
$e["$indx"]["n"] = ereg_replace("\\\"",""",$e["$indx"]["n"]);
fwrite ($Pointer, "\$e[\"$indx\"][\"n\"] = \"{$e["$indx"]["n"]}\";\n");
}
if ($e["$indx"]["m"]) {
fwrite ($Pointer, "\$e[\"$indx\"][\"m\"] = \"{$e["$indx"]["m"]}\";\n");
}
{
fwrite ($Pointer, "\$e[\"$indx\"][\"d\"] = \"{$e["$indx"]["$date_format"]}\";\n");
}
if ($e["$indx"]["c"]) {
$e["$indx"]["c"] = ereg_replace("\\\'","'",$e["$indx"]["c"]);
$e["$indx"]["c"] = ereg_replace("\\\"",""",$e["$indx"]["c"]);
fwrite ($Pointer, "\$e[\"$indx\"][\"c\"] = \"{$e["$indx"]["c"]}\";\n");
}
}
fwrite ($Pointer, "?>");

The letters N/M/C are Name/Mail/Comments these three things are recorded in my data file but the D leaves only this:

$e["1"]["n"] = "CurlyMo";
$e["1"]["m"] = "nobody@hotmail.com";
$e["1"]["d"] = "";
$e["1"]["c"] = "test";

// Edit crabboy: Changed email address at Ops request.

j-ray 02-10-2003 06:32 AM

http://www.php.net/manual/en/function.strftime.php
i guess that's what u need
cheers, jens


All times are GMT -5. The time now is 10:05 PM.