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]

Re: st: working with timestamps with milliseconds


From   Michael Mitchell <[email protected]>
To   [email protected]
Subject   Re: st: working with timestamps with milliseconds
Date   Sun, 21 Feb 2010 19:12:53 -0800

Dear David

  Now you are bumping up against the default display format... from
the help file (help dates_and_times), the implied format is...

            Format | Implied (fully specified) format
            -------+---------------------------------
            %tc    | %tcDDmonCCYY_HH:MM:SS

 So we can manually specify the format to get the entire precision,
for example...

. clear

. inp str30 time
                               time
  1. "1-22-2007 3:44:22"
  2. "1/23/2008 02:23:11.111"
  3. end

. gen double time2 = clock(time, "MDY hms")
. format time2 %tcDDmonCCYY_HH:MM:SS.sss
. li

     +-------------------------------------------------+
     |                   time                    time2 |
     |-------------------------------------------------|
  1. |      1-22-2007 3:44:22   22jan2007 03:44:22.000 |
  2. | 1/23/2008 02:23:11.111   23jan2008 02:23:11.111 |
     +-------------------------------------------------+

Best regards,
--
Michael N. Mitchell
See the Stata tidbit of the week at...
http://www.MichaelNormanMitchell.com
Visit me on Facebook at...
http://www.facebook.com/MichaelNormanMitchell
*
*   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