home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 67,154 of 68,980   
   Dr J R Stockton to All   
   Re: WSH VBS question   
   10 Feb 18 02:47:42   
   
   From: J.R.Stockton@physics.org   
      
   On Friday, February 9, 2018 at 9:41:45 PM UTC, JJ wrote:   
   > On Fri, 9 Feb 2018 05:20:01 -0800 (PST), Dr J R Stockton wrote:   
   > > On Friday, February 9, 2018 at 11:36:13 AM UTC, JJ wrote:   
   > >> On Thu, 8 Feb 2018 13:30:07 -0800 (PST), Dr J R Stockton wrote:   
   > >>> Within Windows Scripting Host running VBScript, e.g. in '   
   > >>>   Prompt>CScript //nologo FILE.VBS  ',   
   > >>> is it possible, given a general CDate variable, to   
   > >>> determine the offset from GMT/UTC of the date/time   
   > >>> represented by the value of the variable, or equivalent   
   > >>> information, and if so how,   
   > >>>    
   > >>> (a) Using features of VBScript itself,   
   > >>> (b) Otherwise, using some API or system call,   
   > >>> without invoking JScript?   
   > >>    
   > >> Since VB date represent the local time, and IEEE date represent the UTC   
   > >> time, the time difference will give you the time zone of your system. So,   
   > >> manually decode the IEEE date then compare the result with the one   
   converted   
   > >> from CDate.   
      
   A single time difference or offset is not necessarily enough to determine Time   
   Zone, which represents the Standard Time (= Winter Time) offset from UTC, in   
   spite of the fact that Microsoft think differently.   
      
      
   > > So how does one get the "IEEE date", whatever that term is supposed to   
   mean, corresponding to the aforementioned CDate variable, preferably using   
   just VBScript, and in what form does one get it?   
   >    
   > IEEE date format (AFAIK, same as POSIX time format) is the number of   
   > milliseconds since January 1st 1970 UTC. IIRC, the official storage format   
   > is a 64-bit integer but 64-bit floating point can be used to contain it too.   
      
   That is a way, used in some languages and operating systems, of storing an   
   integer number of seconds in an IEEE-754 64-bit variable.  Google shows a mere   
   10 references to "IEEE date format"; about half of them refer to your format   
   and about half to    
   something matching or like the commonest of the ISO 8601 date formats.  If the   
   IEEE really had defined a sensible date format (other than by reference to   
   ISO), I would have learned of it long ago.   
      
   My question to you was 'how does one get the "IEEE date"' (which you cited); I   
   don't need to be told how to deal with it - provided that it is indeed   
   independent of locality.  And I want to get it by using VBScript.   
      
      
      
   > You can use the MOD operator and `\` (integer divide) to extract the   
   > millisecond (of a second), second, minute, and hour.   
   >    
   >   millisecond = SourceDate mod 1000   
   >   remain = SourceDate \ 1000   
   >   second = remain mod 60   
   >   remain = remain \ 60   
   >   minute = remain mod 60   
   >   remain = remain \ 60   
   >   hour = remain mod 24   
   >   remain = remain \ 24   
   >    
   > It'll get more complicated once you start extracting the day (of month) and   
   > greater time units because leap year should be taken into account. I'm not   
   > versed on calculating these, so I'd suggest googling for it. Or maybe   
   > someone here or in other programming newsgroups, knows.   
      
   Why search for it?  The Leap Year Rules and the month lengths should all have   
   been taught in schools (they, and other stuff, were printed on the back cover   
   of school exercise books in my day) - and they are not needed, since I am only   
   interested in the    
   time offset (and am prepared to disregard those who live 12 hours or more away   
   from GMT).   
      
   See, for example,   
   .   
      
   --    
     (c) John Stockton, near London, UK.  Using Google Groups.           |   
    Mail: J.R.""""""""@physics.org - or as Reply-To, if any.             |   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca