Click to See Complete Forum and Search --> : ASP % equivalent and Date() object


David Harrison
04-06-2004, 11:30 AM
Hi everyone, does anyone know the VBScript equivalent of client-side JavaScript's % which gives the remander when one number is divided by another, so for example 5%3 would equal 2.

Also, I am using ASP's built in Date() object but since the server is a few hours behind GMT it sometimes gets it wrong, so is there a way to correct for this? Is there a way to do this for the time as well?
Even better, is it possible to detect what time zone a user is in and how far ahead or behind they are? This would mean that the times and dates are always correct for everyone.

buntine
04-06-2004, 11:40 AM
For modulus, VBScript uses the mod operator.

dim x
x = 10 mod 3 'should return 1.


As for the date/time issue, take a look at this article. http://www.webwizguide.info/asp/faq/date_time_settings.asp

Regards,
Andrew Buntine.

David Harrison
04-06-2004, 12:00 PM
Thanks for the mod operator, but the dates and times thing isn't quite what I need:

Please note that this will only change the format the dates, times, and currencies are shown in and will not move dates and times to another time zone. eg. mm/dd/yyyy to dd/mm/yyyy.I have already sorted out the dd/mm/yyyy thing, I just need to change the time zone to GMT (or if possible, change the time zone to match the time zone that the user is in).

redijedi
04-06-2004, 12:25 PM
You'd have to find out what the server time offset is and then you can use the dateadd function

Small VB example:

MsgBox DateAdd("h", 1, Now)


As far as finding out the time of the browser, you would have to use javascript (or jscript, javascript's bastard brother).

David Harrison
04-06-2004, 12:51 PM
I could find the time on the user's clock very easily with JavaScript, it's just that that would involve a refresh of the page so that the script could get the info transferred to it.
Then I would have to start using Session variables (which apparently are a bad thing) to keep that information available for the script to use.
It's a real shame that there is no server-side way to obtain that stuff. :(

Ah well, back to work on the script for me. Thanks guys.

buntine
04-06-2004, 09:17 PM
We should devise some wicked technology thats allows client-server communication easily.

David Harrison
04-06-2004, 10:25 PM
We could call it LavaScript. :D

buntine
04-06-2004, 11:45 PM
Or BuntineIsSoCoolIWishIWasJustLikeHim++ ;)