Results 1 to 8 of 8

Thread: Add date to CSV file name

  1. #1
    Join Date
    Dec 2008
    Posts
    3

    Default Add date to CSV file name

    Hi!

    I'm using formmail with the [fmhookload] found on this forum to write several forms to specific CSV files.

    Is it possible to add a timestamp to a CSV file name in order to create one CSV per day for a specific form?

    E.g.
    - 081201_formresults.csv
    - 081202_formresults.csv
    - etc.

    Happy to hear from anyone

  2. #2
    Join Date
    May 2008
    Posts
    1,291

    Default Re: Add date to CSV file name

    Hi,

    This should work: (goes in your form code)

    Code:
    <input type="hidden" name="csvfile" value="formresults.csv">
    <input type="hidden" name="derive_fields" value="csvfile=%moy0%.%dom0%.%year%.%'_'%.csvfile" />
    Of course, if you're already using derive_fields for something else, just add this value to the existing tag or one will be overwritten by the other.

    ginger

  3. #3
    Join Date
    May 2008
    Posts
    1,291

    Default Re: Add date to CSV file name

    Just a note; if you're specifying the csvfile in your INI file, then this won't work because the INI file is processed after derive_fields (which is in the form), and derive_fields can't be put in the INI file.

    However, if you can specify the csvfile in the form, it should work just fine.

    ginger

  4. #4
    Join Date
    Jan 2009
    Posts
    7

    Default Re: Add date to CSV file name

    What would the code be for date AND time.

  5. #5
    Join Date
    Jan 2009
    Posts
    7

    Default Re: Add date to CSV file name

    Lucky guess=
    %time%

  6. #6
    Join Date
    May 2008
    Posts
    1,291

    Default Re: Add date to CSV file name

    %time% is correct, but check out this page for formatting options.

    http://www.tectite.com/fmhowto/derived.php

    ginger

  7. #7
    Join Date
    Jan 2009
    Posts
    7

    Default Re: Add date to CSV file name

    Thanks, Ginger.

  8. #8
    Join Date
    Jan 2009
    Posts
    7

    Default Re: Add date to CSV file name

    Thanks you. Great link for my needs.
    Jill

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Attaching CSV file
    By eu4ic in forum FormMail Subscription Support
    Replies: 6
    Last Post: 01-Jun-2005, 10:58 PM
  2. Save to CSV file not working, Directory path
    By mkw in forum FormMail Subscription Support
    Replies: 3
    Last Post: 01-Oct-2004, 11:28 PM
  3. Downloading CSV file in Access
    By jgold723 in forum FormMail Subscription Support
    Replies: 2
    Last Post: 30-Aug-2004, 10:35 AM
  4. auto add feature
    By jamesh3 in forum FormMail Subscription Support
    Replies: 1
    Last Post: 17-Jun-2004, 06:44 AM
  5. Date/Timestamp
    By projpeople in forum FormMail Subscription Support
    Replies: 6
    Last Post: 21-May-2004, 03:51 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •