Bookmark and Share

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: RE: Question on using formatted dates in a filename (or getting it into a local)


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Question on using formatted dates in a filename (or getting it into a local)
Date   Tue, 30 Mar 2010 15:51:14 +0100

"DMY" needed in both cases, not "dmy". 

Nick 
[email protected] 

Eduard Grebe

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?


*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index