Datestamp an exported file from php/mysql

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • drec

    Datestamp an exported file from php/mysql

    I have setup a script which will query a mysql db and then give the
    option to export this file to a filename that I have setup. As of now
    I am just calling it export.csv, but I would like to be able to add the
    date to this file name to avoid duplicates.

    Can anyone point me in the right direction?

  • Erwin Moller

    #2
    Re: Datestamp an exported file from php/mysql

    drec wrote:
    [color=blue]
    > I have setup a script which will query a mysql db and then give the
    > option to export this file to a filename that I have setup. As of now
    > I am just calling it export.csv, but I would like to be able to add the
    > date to this file name to avoid duplicates.
    >
    > Can anyone point me in the right direction?[/color]

    Hi,

    go to www.php.net and look for a function named date().
    If you only feed the wished format, and not a timestamp, it will use now.

    eg:
    $filename = "backupOn";
    $filename .= date('d_m_Y');
    $filename .= ".csv";

    will produce something like:
    backupOn27_6_20 06.csv

    Just browse through all formatoption and take your pick.

    Good luck.

    Regards,
    Erwin Moller

    Comment

    Working...