Mombu the Microsoft Forum

Mombu the Microsoft Forum > Microsoft > Windows 2003 Server (TECHNET) > Using JScript date function in VBScript code
REGISTER NOW! Search Today's Posts Mark Forums Read




Reply
 
Thread Tools Search this Thread Display Modes
1 27th April 20:01
matty j
External User
 
Posts: 1
Default Using JScript date function in VBScript code



Hi all
I've been scouring these newsgroups but can't find what I'm looking
for.

I've got a number of VBScript scheduled tasks which do updating of
feeds and record time stamps. However, with different servers there is
different times because of daylight saving etc.

I've got to the point where I've converted my VBScript into a WSF
function, and I've had a hack at a few JScript functions to write a
JScript function which I intend to link in via
<script language="JScript" src="D:\Inetpub\feeds\code\functions
\gmt.js" />
into my WSf file and that I intend will accept a date from a VBS line
of code and return a GMT/UTC formatted date.

However I've been banging my head against a wall for 4 hours or so now
trying to get it to work, and it seems to be down to the fact that
JScript is expecting an actual date object for the function to work,
whereas VBscript is passing the date as a string.

I've seen the VBS registry reading code but don't really want to use
it.

Would so greatly appreciate if someone could put together a demo of
how I can simply and neatly link a JScript GMT / UTC function file
into a WSF file and call that function from VBScript within the WSF
file and msgbox out a GMT/UTC formatted date...

Is it actually possible?
Any help so greatly appreciated.
Cheers
Matt
  Reply With Quote
SPONSORED LINKS BY GOOGLE

 


2 1st May 19:45
dr j r stockton
External User
 
Posts: 1
Default Using JScript date function in VBScript code



In microsoft.public.scripting.wsh message <1176483517.348992.33280@d57g2
000hsg.googlegroups.com>, Fri, 13 Apr 2007 09:58:37, Matty J
<mattyjensen@gmail.com> posted:


Then you can write the javascript to expect a string, or you can write
the VBscript to provide a day or milliseconds number, which is better.

If it is a current date/time, then you can get the JS to store the
current Offset and let VB do the rest of the work.

See via <URL:http://www.merlyn.demon.co.uk/vb-dates.htm>; consider the
following as HTML including script. To link files, see <URL:http://www.
merlyn.demon.co.uk/js-nclds.htm>.

HTML:

In ten microdays' time

<script type="text/javascript">

function LZ(x) { return (x>=10||x<0?"":"0") + x }
function LZZ(x) { return x<0||x>=100?""+x:"0"+LZ(x) }

function CDateToUTCstr(CD) {
var D = new Date(1899, 11, 30+Math.floor(CD), 0, 0, 0, 864e5*(CD%1))
with (D) return getUTCFullYear() + "-" +
LZ(getUTCMonth()+1) + "-" + LZ(getUTCDate()) + " " +
LZ(getUTCHours()) + ":" + LZ(getUTCMinutes()) + ":" +
LZ(getUTCSeconds()) + "." + LZZ(getUTCMilliseconds()) }

</script>

it will be
<script type="text/VBscript">
document.write CDateToUTCstr(Cdbl(Now + 1e-5))
</script>

UTC.


It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
  Reply With Quote
3 1st May 19:45
matty j
External User
 
Posts: 1
Default Using JScript date function in VBScript code


Legend!!

Thankyou very much, that did the trick!

Cheers
Matt

PS. I was extremely confused by your site initially as I was browsing
with Firefox and scrolled using the table of contents and therefore
didn't initially see the "! ! This page expects VBscript ! !", and in
fact when I read that I, admittedly after a night out last night,
didn't know what it meant - I thought strangly it was saying that I
needed to input VBScript to the page somehow. Maybe - 'please note:
this page requires your browser to support client side VBscript to see
all features and functionality contained' or something...? Anyway,
thanks a lot again :-)
  Reply With Quote
SPONSORED LINKS BY GOOGLE

 


4 16th August 22:29
asdf
External User
 
Posts: 1
Default Using JScript date function in VBScript code


You are still resting your help on machine settings.


There is no what so ever clue, on how a user can get real time to his/her
machine.

------------------------------------------------------------------------------------------------------------------------

Do apply a routine in DOS or nt.DOS that relates to existing "services".

-----------------

Then you can talk about, on how on to apply machine values to
a scripting routine for a user to be used in a routine.

----------------------------

All other ropes your are pulling here
are of the bell curve, ready to assisting killers of opinions not in line
with your government or bloddy line of education in this century in year 7.

-------------------------

Sure, J.R. , and the movies were made in California , not in Texas, Fella.
  Reply With Quote
5 16th August 22:29
asdf
External User
 
Posts: 1
Default Using JScript date function in VBScript code


He better open up a little.
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes







Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
Also visit Ogoun the Usenet Archive
666