Can anyone explain why the time has been changed - 19:10:00 to
19:08:55 - in Svend's example, and how to correct this where
necessary?
Many thanks
Paul
>
> To make the date and time sortable, combine the two strings into
> one, and next transform the string into a numeric date-and time
> (tc) variable. (It has the numeric value of the number of
> milliseconds (!) since 1 January 1960):
>
> . clear
> . set obs 1
> . gen str sdate = "12112008"
> . gen str stime = "19:10:00"
> . gen sdatetime = sdate + " " + stime
> . gen datetime = clock(sdatetime,"DMY hms")
> . format datetime %tc
> . list, clean
> sdate stime sdatetime datetime
> 1. 12112008 19:10:00 12112008 19:10:00 12nov2008 19:08:55
>
> Hope this helps
> Svend
*
* 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/