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: datetime different in Stata 12?
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: datetime different in Stata 12?
Date
Mon, 8 Oct 2012 17:27:13 +0100
The handling of dates and times did not change between 11.2 and 12.
These dates are just different; I suspect that you have uncovered a
glitch in the help file, in that an example has been only partially
updated.
. clear
. set obs 1
obs was 0, now 1
. generate double datetime_1 = 1479597200000
. generate double datetime_2 = tc(20jan2010 09:15:22.120)
. format datetime_* %tc
. list
+-----------------------------------------+
| datetime_1 datetime_2 |
|-----------------------------------------|
1. | 19nov2006 23:13:20 20jan2010 09:15:22 |
+-----------------------------------------+
. format datetime_* %21.0f
. list
+-------------------------------+
| datetime_1 datetime_2 |
|-------------------------------|
1. | 1479597200000 1579598122120 |
+-------------------------------+
On Mon, Oct 8, 2012 at 5:07 PM, Skipper Seabold <[email protected]> wrote:
> Can anyone confirm that what's listed here [1] is correct for version
> 12? I'm using Stata 11.2 and I'm not getting this. Am I doing
> something wrong? According to the docs, the datetime/c listing should
> be
>
> 20jan2010 09:15:22.120
>
> In 11.2 I get
>
> 19nov2006 23:13:20
>
> What changed? Seems a bit too big to be leap years and leap seconds.
> Perhaps it's just a mistake?
>
> Similarly, the datetime/C value is not this either.
>
> set obs 1
> generate double datetime_c = 1479597200000 in 1
> format datetime_c %tc
>
> Now if I do
>
> clear
> set obs1
> generate double datetime_c = tc(20jan2010 09:15:22.120) in 1
>
> I get
>
> 1579598122120
>
> Surely the behavior of something so fundamental didn't change between
> 11.2 and 12.
>
> Thanks,
>
> Skipper
>
> [1] http://www.stata.com/help.cgi?datetime#s2
>
*
* 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/