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,153 of 68,980   
   JJ to Dr J R Stockton   
   Re: WSH VBS question   
   10 Feb 18 04:41:43   
   
   From: jj4public@vfemail.net   
      
   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.   
   >   
   > 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.   
      
   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.   
      
   --- 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