Form Mail time stamp

software development

#1

I have created a form that uses Dreamhost’s formmail script. It works with no problem, however the time stamp that is stated in the generated e-mail…

“Below is the result of your feedback form. It was submitted by (somebody@somewhere.com) on Tuesday, April 05, 2005 at 17:29:22”

… is 3 hours off because I am in a different time zone. Is there a way to adjust the time?

Thanks,

Chris.


#2

I’m having the same issue… both with forms, and with time date stamps in PHP. Suggestions for adjusting both would br appreciated.

Thanks!


#3

Ok, so here’s a shot at this…

As far as the dreamhost form mail goes I believe that the is no way for you to change the time on this. Becuase this is a script that dreamhost has, and you don’t have the ability to change it you’ll have to deal with the time it sends out.

A way around this would be to install you own form mail script. I heavn’t done this recently, but basically you download your CGI script and possibly some associated files, configure it to work on your server. Then you set up your form to post to your script instead of DH’s.

I can’t reccomend a specific program becuase I heavn’t done this in a while. Try searching for it, and looking on sourceforge. Then once you find this program it may have instructions on how to change the time, or you can seek some specific advice from the creator or basic CGI commands. All in all there is not a very simply solution, and you might just want to put up with the three hour difference.

As far as PHP goes, you should also be able to look into you coding and find a way to modify the way it is printing the date. Check out this link

hope this is helpful, sorry if it’s not.

-Matttail


#4

Mattail,

Thanks. Your suggestions are helpful, and I’m sure will point me in the right direction.

For my current PHP date “issue” all I’m trying to do is set a variable with the local time and date the form was submitted. To do so I used:

$appdate = date(“F jS Y, h:iA.”);

But with the server off by 3 hours, can I modifiy the above by addings 10800 seconds? If so, how would that look? It’s not clear where I’d “add” the seconds :}

Perhaps:

$appdate = (date(“F jS Y, h:iA.”) + 10800);

I dunno.

Thanks!

~Jem


#5

Mattail…

Nevermind, I finally figured out what I needed. I simply needed to add in the Time() stamp to my date function, and then modify like so:

$appdate = date(“F jS Y, h:iA.”, time() + 10800);

Which captures the following in $appdate:

April 20th 2005, 07:44AM.

When the actual server local time is:

April 20th 2005, 04:44AM.

So for others reading, adding " time() + 10800" to the normal Date() function ADDS 3 hours (10800 seconds!) to the local server time.

Don’t know why this wasn’t displayed as an explicit "how to"example somewhere else on the 'Net, as it is a VERY basic thing many people would want to do. I searched for an hour and only found examples way more complex than this.

Cheers,

Jem