Menu

Time/Date Stamp: I Found a Hack

Help
2005-01-20
2013-06-03
  • strunkwriter

    strunkwriter - 2005-01-20

    I was looking for a solution to the whole time/date stamp as a hidden field thing and noticed others had expressed curiousity, too. I think I've found a solution.

    1. Go through the whole create a form process and make a hidden field and give it a name like stamp.

    2. After your forms were created, open the process.php file. Add this line
    "$dtstamp=date("m.d.Y, H:i:s");" to line three of the file (it should be right after the include global line).

    3. Do a search and replace to replace the $stamp with $dtstamp.

    Viola! The date stamp now shows up in the email, the php-generated thank you page and the flat file. (I didn't try it on the mysql database. I'ld be interested to hear how it works.)

    Regards,
    StrunkWriter

     
    • Musawir Ali

      Musawir Ali - 2005-01-21

      good suggestion.

       
    • germanic42

      germanic42 - 2005-02-22

      I followed your directions and it works in email, online database and in the MySql database.

      Thanks

       
    • jack

      jack - 2005-03-20

      Works great, thanks for posting.

      I am in a different timezone then my server is.
      Is there a way to add an offset to time so that localtime is displayed.

      TIA

       
    • Musawir Ali

      Musawir Ali - 2005-03-22

      Try using the following for Step 2:

      $dtstamp = date(("m.d.Y, H:i:s"), mktime(date("G")+OFFSET, date("i"), date("s"), date("m"), date("d"), date("Y")));

      Replace the word OFFSET with the number of hours you want to offset the server time by. You can go either +OFFSET or -OFFSET to go forward or backward. I just came up with this line of code from the top of my head and I haven't tested it out, so it may or may not work. Also, again these are just hacks... I will add this time stamp feature in the next version officially.

       
    • mylogon

      mylogon - 2005-04-11

      How about posting under patches  - so it can be found easily.

       
    • jweisberg

      jweisberg - 2008-03-03

      Can you update this hack for version 3.0?  It does not seem to be working for me.
      "$stamp " in Step 3 doesn't exist.
      I am sending the data to both email and "formdata.txt" but not to a database.
      Can someone please help?

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.