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: Epoch time (aka Unix time) in Stata


From   Nick Cox <[email protected]>
To   [email protected]
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
<[email protected]> 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index