Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Closed Thread
adding 7 hours to time() asp vbscript
Old 04-12-2005, 06:27 AM adding 7 hours to time() asp vbscript
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
Hi all,
I have a load of forum users in hk that are complaining that time is uk gmt. I wouls expect this as the host is based in uk.


How then do I add 7 hours to thier time so that the time they see is hk time.

time() + 7 does not work (obviously i appreciate)

As such, this will sort my initial problem however I would like to ask how I imbed javascript in <% %> code. if thats not a stupid question.
The time I refer to is passed as a parameter in a chat room. the code thats used is below

Application("txt1") = "<B>" & Session("loginname") & ":</B> " & Request.Form("message") &" (" &now() & ")"

You can see where now() is used and because uk host, uk time. Add 7 hours and those in hong kong are happy. However , Id like this standardized so all different countries see different time and I identify on the chat room , what time zone they are in.
The javascript i am usiong to pick out the users date is

<script language="JavaScript" type="text/javascript">

var curDate = new Date();
var formattedDate = curDate.getHours() +":"+ curDate.getMinutes() +":"+ curDate.getSeconds();
document.write(formattedDate);
</script>

But im a little baffled how i include this in my asp if i can at all.

cheers.
Steve
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
View Public Profile Visit numbenator's homepage!
 
 
Register now for full access!
Old 04-16-2005, 10:03 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Convert your javscript into a function and put it into the <head>


<script language="JavaScript" type="text/javascript">
function ShowTime() {
var curDate = new Date();
var formattedDate = curDate.getHours() +":"+ curDate.getMinutes() +":"+ curDate.getSeconds();
document.write(formattedDate);
}
</script>

And use


<%
with response
.write "<script type=" & chr(34) & "text/javascript" & chr(34) & ">"
.write "ShowTime()"
.write "</script>"
end with
%>


to write on the call to the function in to the page. Or convert that into a string of course


<%
dim TimeCode
TimeCode = "<script type=" & chr(34) & "text/javascript" & chr(34) & ">ShowTime()</script>"


Application("txt1") = "<B>" & Session("loginname") & ":</B> " & Request.Form("message") &" (" & TimeCode & ")"
%>
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
View Public Profile Visit chrishirst's homepage!
 
Old 01-13-2006, 12:48 AM Stick to ASP
Junior Talker

Posts: 1
Trades: 0
Quote:
Originally Posted by numbenator
Hi all,

How then do I add 7 hours to thier time so that the time they see is hk time.

time() + 7 does not work (obviously i appreciate)
you should use: -

yourVariable = DateAdd("h",7,Time())

Using javascript is totally unnecessary.... Hope that helps...


Tom
PommyTom is offline
View Public Profile
 
Old 01-13-2006, 06:06 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Why not use the server time, and add something somewhere for the user to select how many hours ahead or behind they are?
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
View Public Profile Visit Minaki's homepage!
 
Old 01-17-2006, 01:51 AM
Bullschmidt's Avatar
Average Talker

Posts: 24
Location: USA
Trades: 0
And that's what I like to do in this way:

Classic ASP Design Tips - Time Zones
http://www.bullschmidt.com/devtip-timezones.asp
__________________
J. Paul Schmidt

Please login or register to view this content. Registration is FREE
- Freelance Web and Database Developer

Please login or register to view this content. Registration is FREE
- Classic ASP Design Tips
Bullschmidt is offline
View Public Profile Visit Bullschmidt's homepage!
 
Closed Thread     « Reply to adding 7 hours to time() asp vbscript
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16853 seconds with 12 queries