Reputation: 77
Is it possible and if it is, how can I create automatically folders that have the names of the current date? I read that mkdir()
will make me do the folders but how exactly to set the name of these folders so when I get information from some link the folder where i have to save this .txt
file to be created with for example - name: 'May-21-2014' (the current date).
Upvotes: 1
Views: 3653
Reputation: 750
mkdir(strftime("%B %d %Y, %X %Z",mktime(20,0,0,12,31,98)),0777,true);
Upvotes: 0
Reputation: 74
http://php.net/manual/en/function.date.php
mkdir(date('Y/m/d'), 0777, true);
Upvotes: -1
Reputation: 33502
The first input of mkdir()
is the name. Just put the string of the date into the value you pass it:
$name=date("l");
makdir($name//etc)
would result in a folder called Monday.
Just format the date as you want it.
I would suggest folders to be yyyymmdd - eg 20140522
for today, it makes them sort nicely in ascending date order in a normal directory browser.
This would be:
$name=date('Ymd');
when you make the folder name.
Upvotes: 2