By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 2,030 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

Datestamp an exported file from php/mysql

P: n/a
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?

Jun 26 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
drec wrote:
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?


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_2006.csv

Just browse through all formatoption and take your pick.

Good luck.

Regards,
Erwin Moller
Jun 26 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.