473,573 Members | 3,279 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2246
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.ge tHours() - 7);
%>
<%= d.toString() %>

See
<URL:http://msdn.microsoft. com/library/en-us/jscript7/html/jsmthsethours.a sp>
PointedEars
Dec 9 '05 #2
On Fri, 09 Dec 2005 02:28:47 +0100, Thomas 'PointedEars' Lahn
<Po*********@we b.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.ge tHours() - 7);
%>
<%= d.toString() %>

See
<URL:http://msdn.microsoft. com/library/en-us/jscript7/html/jsmthsethours.a sp>
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.ge tHours() - 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#ps1P ost>
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.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.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.dem on.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
2269
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 6 hours wrong. The time should be GMT minus 6 hours. Can anyone help me with that? Her's the code: <?php header("Cache-Control: no-cache,...
3
2477
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 <div id="datetime"></div> tags, the text shows up, but the javascript output being sent to those some divs doesn't seem to want to work. It should be...
0
3928
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 Inbox Reply from Craig Somerford <uscos@2barter.net> hide details 10:25 pm (3 minutes ago)
20
4243
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 is structured as an upside-down tree, and (if I remember correctly) never more than 4 levels. The site basically grew (like the creeping black...
5
1979
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, i); // last argument is depth } };
4
1316
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
1704
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 by create date of the file and put in dirs by year and the only data iw ant left in the source dir is this months only and when moving to next month i...
4
2524
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 checked. Now what the script does is it checks the time stamp and creates a year folder if it does not exist and then creates a month folder if it does not...
15
1959
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 messed up. Both the XHTML and CSS validate without any errors or warnings. Can anyone help me figure out what is wrong? I'd be especially interested...
0
7693
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8202
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6418
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5590
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5291
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3732
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3732
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1301
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1040
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.