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: RE: Stata & time zone offset


From   Rebecca Pope <[email protected]>
To   [email protected]
Subject   Re: st: RE: Stata & time zone offset
Date   Wed, 12 Dec 2012 12:12:36 -0600

Daniel,
If you are going to be comparing dates & times, I think it is easier
to avoid -clock()- & just work with -tc()-, keeping your times in
numeric format. Feel free to disregard this...
tc(`c(current_date)' `c(current_time)')+tc(8:00)

You can adjust the "8:00" with a local macro defined based on whether
DST is active/not.




Rebecca



         __o                __o
      _`\ <,_            _`\ <,_
     (_)/   (_)          (_)/   (_)
=========================


On Wed, Dec 12, 2012 at 12:13 AM, Kieran McCaul
<[email protected]> wrote:
> ...
>
> Short answer is "I don't know", but you might want to have a look at:
> http://blog.stata.com/tag/dates/
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Gross
> Sent: Wednesday, 12 December 2012 12:32 PM
> To: [email protected]
> Subject: st: Stata & time zone offset
>
> Hello,
>
> Does anyone know how to get Stata to convert/display times in UTC rather than local time? In particular, on Windows OS, when I launch Stata and enter the command: di c(current_time), it reports back the time in my system time zone (which is currently UTC-08:00). If I change the Windows time zone (e.g. to UTC), re-launch Stata, and type the same command, I get back the time in the newly set time zone.
>
> The reason for asking is because I'm trying to compare timestamps generated by the Stata clock() function (which evidently generate in local time) to POSIX timestamps in an imported dataset (which are in UTC). Because the UTC offset varies with time of year due to daylight savings, this comparison seems to be impossible.
>
> Is that really the case, or does anyone know of a workaround?
>
> Thanks,
> Daniel Gross
> *
> *   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/

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