Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# st: Re: question about working with dates and times

 From "Joseph Coveney" To Subject st: Re: question about working with dates and times Date Tue, 27 Jul 2010 22:52:54 +0900

```Paul Visintainer wrote:

Thanks, Joe.  I think I get it.  Rather than just specifying the interval, one
specifies the desired interval from the zero-point.

--------------------------------------------------------------------------------

In your original post, you mentioned wanting 36 hours, 14 days, etc.  You can
take advantage of the -tc()- pseudofunction by treating
-tc("02jan1960 00:00:00")- as a constant, representing how many milliseconds
there are in one day.  See below for the 36-h, 14-d examples.

The limitation of this tactic is illustrated as -day2- in my first reply,
namely, the increment for "3 months" depends upon which three months of the
year you're trying to span.

Joseph Coveney

. generate double day0 = tc("06oct2007 00:00:00")

.
. * 36 h
. generate double day1 = day0 + ///
>     36 / 24 * tc("02jan1960 00:00:00")

.
. * 14 days
. generate double day2 = day0 + ///
>     14 * tc("02jan1960 00:00:00")

.
. format day? %tc

.
. list day?, noobs

+--------------------------------------------------------------+
|               day0                 day1                 day2 |
|--------------------------------------------------------------|
| 06oct2007 00:00:00   07oct2007 12:00:00   20oct2007 00:00:00 |
+--------------------------------------------------------------+

*
*   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/
```