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

st: RE: AW: RE: Extract Year from String

From   "Nick Cox" <>
To   <>
Subject   st: RE: AW: RE: Extract Year from String
Date   Wed, 14 Oct 2009 12:52:45 +0100

Please do remember to flag if you are working with an outdated Stata
(not 11). 

To put the main point more emphatically, official Stata introduced
functions for clock times in Stata 10. There were no such official
functions in Stata 9.2.  


Martin Weiss

There is an entry in 

-help dates_and_times-

that says:

"    Historical note:  Stata 10's date() function is much improved over
of previous versions, and the mask is
        specified a little differently.  In previous versions, the codes
year, month, and date were y, m, and d
        rather than Y, M, and D.  Under version control, the old codes
allowed and, in fact, the original date()
        function is used.

        The big advantage of Stata 10's date() is that it will translate
run-together dates such as 20061201 (no
        special action by you required) and translate more complicated
strings such as Wed Dec 01 14:22:43 CST
        2006 (special action required in how mask is specified,
that the old date() would not have

Is there anything similar for v9.2?

di  year(dofc(clock("Dec/17/1998 11:30:00 PM", "MDY hms")))

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index