Datestamp an exported file from php/mysql

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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?

Re: Datestamp an exported file from php/mysql

drec wrote:

Quoted text here. Click to load it


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

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

will produce something like:

Just browse through all formatoption and take your pick.

Good luck.

Erwin Moller

Site Timeline