Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Displaying Correct Time

Reply
 
Old 01-14-2009   #1 (permalink)
John Quinn


 
 

Displaying Correct Time

The school district I work for is in two timz zones. When I am in one time
zone I want to subtract 1 hour. The other display the time in the server.

What I have now is Display Time = <%Time -1.00%>. However it appears to be
subtracting 11 hours instead of one hour.

Does anyone know the quick and dirty to do this?

Thanks in Advance

Q!

My System SpecsSystem Spec
Old 01-15-2009   #2 (permalink)
Pegasus \(MVP\)


 
 

Re: Displaying Correct Time


"John Quinn" <JohnQuinn@xxxxxx> wrote in message
news:0AD39F9C-C1A2-4D85-AD05-2DE3BBB2BA0E@xxxxxx
Quote:

> The school district I work for is in two timz zones. When I am in one
> time
> zone I want to subtract 1 hour. The other display the time in the server.
>
> What I have now is Display Time = <%Time -1.00%>. However it appears to be
> subtracting 11 hours instead of one hour.
>
> Does anyone know the quick and dirty to do this?
>
> Thanks in Advance
>
> Q!
It is a little unclear from your post where you want to display the
alternative time and how you're calculating it. With a script? Batch file?
If so, what is the code?


My System SpecsSystem Spec
Old 01-15-2009   #3 (permalink)
John Quinn


 
 

Re: Displaying Correct Time

It is in asp script. The code is :

The Current Time is <%Time -1.00%>

It appears simple, except it does not work.

"Pegasus (MVP)" wrote:
Quote:

>
> "John Quinn" <JohnQuinn@xxxxxx> wrote in message
> news:0AD39F9C-C1A2-4D85-AD05-2DE3BBB2BA0E@xxxxxx
Quote:

> > The school district I work for is in two timz zones. When I am in one
> > time
> > zone I want to subtract 1 hour. The other display the time in the server.
> >
> > What I have now is Display Time = <%Time -1.00%>. However it appears to be
> > subtracting 11 hours instead of one hour.
> >
> > Does anyone know the quick and dirty to do this?
> >
> > Thanks in Advance
> >
> > Q!
>
> It is a little unclear from your post where you want to display the
> alternative time and how you're calculating it. With a script? Batch file?
> If so, what is the code?
>
>
>
My System SpecsSystem Spec
Old 01-15-2009   #4 (permalink)
John Quinn


 
 

Re: Displaying Correct Time

Thanks for Getting Back to ME!

Getting an Object Required Error on the second line of script.

Error is:
Microsoft VBScript runtime error '800a01a8'

Object required: ''

Here is my Current Script:

<%
dtTimeNow = DateAdd("h",-1,dtTimeNow)
WScript.Echo dtTimeNow,DateAdd("h",-1,dtTimeNow),CDate( dtTimeNow - 1.0 )
%>

What am I missing?

I have never used WScript.Echo before, but I like what I read about it and
plan to use it in the future.


"ekkehard.horner" wrote:
Quote:

> John Quinn schrieb:
Quote:

> > The school district I work for is in two timz zones. When I am in one time
> > zone I want to subtract 1 hour. The other display the time in the server.
> >
> > What I have now is Display Time = <%Time -1.00%>. However it appears to be
> > subtracting 11 hours instead of one hour.
> [...]
> This
>
> dtTimeNow = Now
> WScript.Echo dtTimeNow, DateAdd("h",-1,dtTimeNow ), CDate( dtTimeNow - 1.0 )
> 15.01.2009 16:48:50 15.01.2009 15:48:50 14.01.2009 16:48:50
>
>
> shows:
>
> (1) Date* functions should be used to manipulate dates
>
> (2) subtracting 1.0 from a date (internally represented by a floating
> point number) will change the day part
>
My System SpecsSystem Spec
Old 01-15-2009   #5 (permalink)
ekkehard.horner


 
 

Re: Displaying Correct Time

John Quinn schrieb:
Quote:

> Thanks for Getting Back to ME!
>
> Getting an Object Required Error on the second line of script.
>
> Error is:
> Microsoft VBScript runtime error '800a01a8'
>
> Object required: ''
>
> Here is my Current Script:
>
> <%
> dtTimeNow = DateAdd("h",-1,dtTimeNow)
> WScript.Echo dtTimeNow,DateAdd("h",-1,dtTimeNow),CDate( dtTimeNow - 1.0 )
> %>
>
> What am I missing?
>
> I have never used WScript.Echo before, but I like what I read about it and
> plan to use it in the future.
[...]
You can't use the WScript object (provided by the wscript.exe resp. cscript.exe
host) in ASP. I included that line just to get the output; sorry about misleading
you. Just use DateAdd() to calculate the 'other' time and display it.
[...]
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
time not staying correct Vista General
Thumbnails not displaying correct image Vista music pictures video
Internet Time Synchronization Incorrect - Showing Standard Time PowerShell
PLEASE HELP: What is the correct date/time on this image??? Vista General
Correct RAM? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46