timezone in javascript

  • Thread starter Christopher Brandsdal
  • Start date
C

Christopher Brandsdal

Hi!

I have a javascript serverside script that stores the "Date" command in a
database.
The problem is that I am in Norway, ans the server is in Florida!
It's a BIG timedifference.

When I use ASP I just use the <% Session.LCID = 1044 %> command at the top
of the page.

Is there something like this javascript also?

Thanks!
Christopher Brandsdal
 
E

Evertjan.

Christopher Brandsdal wrote on 20 aug 2003 in
microsoft.public.inetserver.asp.general:
I have a javascript serverside script that stores the "Date" command
in a database.
The problem is that I am in Norway, ans the server is in Florida!
It's a BIG timedifference.

When I use ASP I just use the <% Session.LCID = 1044 %> command at the
top of the page.

A "javascript serverside script" is ASP !

ASP is not another word for vbscript !

ASP is a platform both for jscript and vbscript.

Session.LCID = 1044 (Nynorsk) should also work for jscript,
but it changes only the DATEFORMAT, not the TIMEZONE.


=====================

Perhaps the best serverside javascript for your question is IMHO:

d = new Date();
tz = d.getTimezoneOffset();

With the variable tz, the difference between the servertime and UTC, you
can construct your own local time in serverside jscript and in serverside
vbscript.

The translation from UTC to your local (summer)time cannot be done
without you suplying the specific info for that.

=================================

another way to get UTC:

<script language="JScript" runat=server>
var d = new Date();
var utcd = d.toGMTString();
Response.Write('Current = ' + d + '<br>UTC = ' + utcd );
</script>
 
A

Aaron Bertrand - MVP

Maybe this, from http://www.aspfaq.com/2218 is useful:

<script language="JScript" runat=server>
var od = new Date();
var nd = od.toGMTString();
Response.Write('Current = ' + od + '<br>UTC = ' + nd);
</script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,083
Messages
2,570,591
Members
47,212
Latest member
RobynWiley

Latest Threads

Top