Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: Question on using formatted dates in a filename (or getting it into a local)


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: Question on using formatted dates in a filename (or getting it into a local)
Date   Tue, 30 Mar 2010 17:02:17 +0200

<> 

Michael`s Stata Tidbit http://www.michaelnormanmitchell.com/stow/always-starting-a-log.html of a couple of weeks ago also contains useful advice in the area you are concerned with.



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Eduard Grebe
Gesendet: Dienstag, 30. März 2010 16:45
An: statalist@hsphsun2.harvard.edu
Betreff: st: Question on using formatted dates in a filename (or getting it into a local)

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/


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index