[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: converting elapsed days to date.

From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   Re: st: converting elapsed days to date.
Date   Thu, 28 Aug 2008 09:59:03 -0400

As Maarten points out, -format- will display an elapsed
date in conventional notation.

If on the other hand you truly want to "reverse this"
and separate out the components of an elapsed date, then
see the functions -year()-,-month()-, and -day()-.

. gen year=year(stdate)


Maarten buis wrote:
--- Ashim Kapoor <[email protected]> wrote:
I understand that if I have the month , day ,year I can do

gen stdate= mdy(month,day,year)

is there a way I can "reverse this" ie. given the elapsed days can I
figure out todays date in the format 20080828 for say today?
Yes, you use -format-, see: -help format-

-- Maarten

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

Send instant messages to your online friends *
* For searches and help try:

*   For searches and help try:

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