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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Epoch time (aka Unix time) in Stata


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Epoch time (aka Unix time) in Stata
Date   Wed, 3 Oct 2012 08:58:31 +0100

Stata's date and time functions were revised in Stata 10. One
consequence is that "mdy" only works as an argument to -date()- under
version control:

. di date("1/1/1970","mdy")
.

. version 9: di date("1/1/1970","mdy")
3653

If your data are in seconds, see for one solution

http://statabytes.andrewdyck.com/blog/working-with-unix-timestamps-in-stata/

(Stata users can't write Stata functions, only Stata commands and Mata
functions.)

Nick

On Wed, Oct 3, 2012 at 5:01 AM, Michael Costello
<michaelavcostello@gmail.com> wrote:

> I have quite a bit of date information that is stored in epoch time
> (aka Unix time).  I need to convert it to something readable.  I found
> this post (http://www.stata.com/statalist/archive/2002-09/msg00518.html)
>  in the archives, but the code doesn't seem to run (perhaps because of
> differences in Stata since 2002).  Does anyone know an easy method, or
> has anyone written a function to do these conversions?
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index