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]

Re: st: Date string to date


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Date string to date
Date   Sun, 24 Nov 2013 15:55:54 +0000

Whatever you do you will need to watch out for values such as 8/6 and
6/8 for DM and MD.
Nick
[email protected]


On 24 November 2013 13:45, Nick Cox <[email protected]> wrote:
> <>
>
> It should be. The only question is how best to do it.
>
> For example,
>
> gen double ndate = date(sdate, "MDY hm")
> replace ndate = date(sdate, "DMY hm") if missing(ndate)
>
> might be sufficient.
>
> Note that "4/15/2011 9:30" is "MDY hm" not dmy (or DMY).
>
> Nick
> [email protected]
>
>
> On 24 November 2013 12:55, lars Folkestad <[email protected]> wrote:
>> Dear List
>>
>> I have a string variable where the dates entered are not stricky dmy it looks like this
>> date
>> 12/15/2010 10:50 (mdy)
>> 24-MAY-2010 9:43 (dmy)
>> 4/15/2011 9:30 (dmy)
>>
>> Is it possible to create a date variable from this ditectly?
>>
>> Lars
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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