Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Question on using formatted dates in a filename (or getting it into a local)
From
Eduard Grebe <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Question on using formatted dates in a filename (or getting it into a local)
Date
Tue, 30 Mar 2010 16:45:27 +0200
Dear All
I would like to save my logs in a way that sorts them chronologically in
the filesystem. For this they have to have dates formatted as follows:
2010.03.30-logfilename.log
However, I am struggling to create a local containing the current date
in that format. I am managing to display the current date that way, but
not putting it in a local.
This:
di %tdCCYY.NN.DD date(c(current_date),"DMY")
Gives this output:
2010.03.30
But, this
local date = string(date(c(current_date), "dmy"), "%
tdCCYY.NN.DD")
di `date'
Gives an empty output.
Can anyone point me in the right direction?
Thanks!
Eduard
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/