Form Time Stamp

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nootkan
Forum Newbie
Posts: 14
Joined: Sat Mar 08, 2008 2:41 pm

Form Time Stamp

Post by nootkan »

Hello I am trying to get a timestamp that indicates when the form was sent to me. Here's what I tried based on my existing processor.php code and what I found in the php.net manual but it doesn't seem to give me the time or any errors but does give me the "Time Submitted" text then blank space. I have to assume I'm not far off.

Code: Select all

" . $mail_message . "Form Submitted by IP Address: ".$_SERVER['REMOTE_ADDR']."\n

Code: Select all

" . $mail_message . "Time Form Submitted: ".$_SERVER['REQUEST_TIME']."\n
The line above this one gives me the ip address without any problems, so I thought this would be the way to get the time. Is this the wrong approach?
Nootkan
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Form Time Stamp

Post by Christopher »

Try:

Code: Select all

" . $mail_message . "Time Form Submitted: " . date('Y-m-d h:i:s') . "\n
(#10850)
nootkan
Forum Newbie
Posts: 14
Joined: Sat Mar 08, 2008 2:41 pm

Re: Form Time Stamp

Post by nootkan »

arborint, thanks for that, it works. It is two hours more than my current time zone, but I'll just subtract the difference when I need too. Thanks again.
Nootkan
Post Reply