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]

st: AW: Date format


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: Date format
Date   Mon, 8 Mar 2010 16:47:37 +0100

<> 



*************
clear*

inp str20(exitdate entrydate) 
"22jan2010 00:00:00"  "01jan2008 00:00:00"
"22jan2010 00:00:00"  "16jan2009 00:00:00"
"22jan2010 00:00:00"  "01jan2006 00:00:00"
"22jan2010 00:00:00"  "16jan2008 00:00:00"
"22jan2010 00:00:00"  "16jan2009 00:00:00"
"22jan2010 00:00:00"  "15jun2008 00:00:00"
"22jan2010 00:00:00"  "15jun2008 00:00:00"
"22jan2010 00:00:00"  "01jan2007 00:00:00"
"22jan2010 00:00:00"  "01jan2005 00:00:00"
"22jan2010 00:00:00"  "01jan2007 00:00:00"
end

gen int newexitdate=dofc(clock(exitdate, "DMY hms"))
gen int newentrydate=dofc(clock(entrydate, "DMY hms"))
form newentrydate newexitdate %tdMon_dd,_CCYY
list new*, noobs
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Mansour Ndiath
Gesendet: Montag, 8. März 2010 11:30
An: [email protected]
Betreff: st: Date format

hello guys
I am experincing difficulties in formatting dates with stata. I have two
variables Entrydate and Exitdate I want to change the format into DMY. How
can I got about it? any support is much appreciated  
here is the output of the variables
+-----------------------------------------+
     |           Exitdate            entrydate |
     |-----------------------------------------|
  1. | 22jan2010 00:00:00   01jan2008 00:00:00 |
  2. | 22jan2010 00:00:00   16jan2009 00:00:00 |
  3. | 22jan2010 00:00:00   01jan2006 00:00:00 |
  4. | 22jan2010 00:00:00   16jan2008 00:00:00 |
  5. | 22jan2010 00:00:00   16jan2009 00:00:00 |
     |-----------------------------------------|
  6. | 22jan2010 00:00:00   15jun2008 00:00:00 |
  7. | 22jan2010 00:00:00   15jun2008 00:00:00 |
  8. | 22jan2010 00:00:00   01jan2007 00:00:00 |
  9. | 22jan2010 00:00:00   01jan2005 00:00:00 |
 10. | 22jan2010 00:00:00   01jan2007 00:00:00 |
     +-----------------------------------------+
Mansour Ndiath
Senegal


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


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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index