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: Extract date and time from a date/time variable
From
Pinaki Mitra <[email protected]>
To
[email protected]
Subject
st: Extract date and time from a date/time variable
Date
Wed, 11 May 2011 13:46:16 +0000 (UTC)
Hello,
I have a date/time variable "ActivityDate" which is double and in %tc format. For example, a value of "ActivityDate" is "01mar2011 11:56:00". I need to extract date and time into two variables. I did gen ActivityDay=dofc( ActivityDate) and format ActivityDay %dN/D/Y which provided me the date as 03/01/11. What can I do to extract "11:56:00" into a new variable "ActivityTime"?
Thank you,
Pinaki Mitra
*
* 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/