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


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
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: [email protected] [mailto:[email protected]] Im Auftrag von Eduard Grebe
Gesendet: Dienstag, 30. März 2010 16:45
An: [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index