473,385 Members | 1,325 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Need script showing time minus 7 hrs

I need a script for my site that shows my servertime minus 7 hours.
Anyone who can help?
Dec 9 '05 #1
5 2235
Jumbo wrote:
I need a script for my site that shows my servertime minus 7 hours.
Anyone who can help?


In JScript(.NET)/ASP (untested):

<%@ LANGUAGE = JScript %>
...
<%
var d = new Date();
d.setHours(d.getHours() - 7);
%>
<%= d.toString() %>

See
<URL:http://msdn.microsoft.com/library/en-us/jscript7/html/jsmthsethours.asp>
PointedEars
Dec 9 '05 #2
On Fri, 09 Dec 2005 02:28:47 +0100, Thomas 'PointedEars' Lahn
<Po*********@web.de> wrote:
Jumbo wrote:
I need a script for my site that shows my servertime minus 7 hours.
Anyone who can help?


In JScript(.NET)/ASP (untested):

<%@ LANGUAGE = JScript %>
...
<%
var d = new Date();
d.setHours(d.getHours() - 7);
%>
<%= d.toString() %>

See
<URL:http://msdn.microsoft.com/library/en-us/jscript7/html/jsmthsethours.asp>
PointedEars

Thanks, but do I place the code in the header?
Dec 9 '05 #3
Jumbo wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
Jumbo wrote:
I need a script for my site that shows my servertime minus 7 hours.
Anyone who can help?


In JScript(.NET)/ASP (untested):
[1] <%@ LANGUAGE = JScript %>
...
[2] <%
var d = new Date();
d.setHours(d.getHours() - 7);
%>
[3] <%= d.toString() %>

[...]


Thanks, but do I place the code in the header?


No. (HTTP) headers are not parsed by ASP(.NET).
(If you mean the (X)HTML `head' element by `header': it depends.)

[1] AFAIK must be placed before any other server-side script code.
See MSDN Library for details.

[2] can be placed anywhere after [1] and before [3], for easy
maintenance probably right before [3] as written here.

[3] should be placed where the date string is to be included.

Please learn how to quote:
<http://jibbering.com/faq/faq_notes/pots1.html#ps1Post>
PointedEars
Dec 9 '05 #4
JRS: In article <sv********************************@4ax.com>, dated
Fri, 9 Dec 2005 01:48:24 local, seen in news:comp.lang.javascript, Jumbo
<ng*@mail.dk> posted :
I need a script for my site that shows my servertime minus 7 hours.
Anyone who can help?


But what is servertime - UTC or local?

If it is local, what is servertime minus 7 hours when the true time is
2006-03-26 04:00 UTC (assuming a Danish server)? 21:00 or 20:00 ?

Javascript on a Web page - the prime topic of this group - has no access
to servertime; but, if the local computer is correctly set, it does have
access to UTC, from which the local time at any location for which the
Summer Time rules are known can be calculated.

Read the FAQ; see below.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<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.
Dec 9 '05 #5
On Fri, 9 Dec 2005 21:57:01 +0000, Dr John Stockton
<jr*@merlyn.demon.co.uk> wrote:
JRS: In article <sv********************************@4ax.com>, dated
Fri, 9 Dec 2005 01:48:24 local, seen in news:comp.lang.javascript, Jumbo
<ng*@mail.dk> posted :
I need a script for my site that shows my servertime minus 7 hours.
Anyone who can help?


But what is servertime - UTC or local?

If it is local, what is servertime minus 7 hours when the true time is
2006-03-26 04:00 UTC (assuming a Danish server)? 21:00 or 20:00 ?

Javascript on a Web page - the prime topic of this group - has no access
to servertime; but, if the local computer is correctly set, it does have
access to UTC, from which the local time at any location for which the
Summer Time rules are known can be calculated.


I thought this would always show my time..........
Dec 10 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Gerry | last post by:
As I'm not a PHP-prgrammer at all, I just need Help with this: I have had a guestbook-page in Europe and will now have to move it to a US based-server. This makes the time-function showing time...
3
by: rsteph | last post by:
I have a script that shows the time and date. It's been working on my site for quite a while now. Suddenly it stops showing up, after getting my drop down menu to work. If I put text between the...
0
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need ...
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
5
by: -Lost | last post by:
See, in ActionScript (Flash) I was able to do it this way: frame 1 { this.onEnterFrame = function () { if (buttonIsDown) { i += 1; duplicateMovieClip(_root.layer.target, 'variable_name' + i,...
4
by: pbd22 | last post by:
Hi. In my script the below code creates a new element on the page with an associated delete button: var row_element = new Element( 'div', { 'class':'container', 'events':{
2
by: jonathan184 | last post by:
Hi basically what i want this script to do is In a particular dir there are alot of files from today back to 1999 or earlier. So I am trying to have the script search this dir and sort the files...
4
by: jonathan184 | last post by:
Hi I have a perl script, basically what it is suppose to do is check a folder with files. Now the files are checked using a timestamp with the command ls -l so the timestamp in this format is...
15
by: rhino | last post by:
I've put together a prototype of two-tiered CSS tabs that works really well in IE6, IE7, and FF2. It also works very well in Opera 9.27 _except_ that the placement of the lower tier of tabs is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.