Wrox Programmer Forums
|
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 26th, 2003, 07:06 PM
Authorized User
 
Join Date: Oct 2003
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default Time zone trouble!

Hi all,
 I live in Norway, but my web host is outside my timezone. All was well untill today. Now Norway has changed to winter time, and all the posts people make on my site are all 1 hour wrong..
 I've been playing around with the TimeZone and Date Class, but I just don't figure out how to get my date right.. Anybody done this before?


****************MY CURRENT CODE FOR DATE/TIME******
Dim strDate As String = Right("00" & Now.Day, 2) & Right("00" & Now.Month, 2) & Right("00" & Now.Year, 2) & ":" & Right("00" & Now.Hour, 2) & Right("00" & Now.Minute, 2)

------------------------
All help is Good help!
Regards
Michael
__________________
------------------------
All help is Good help!
Regards
Michael
 
Old November 2nd, 2003, 12:28 AM
Authorized User
 
Join Date: Jun 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sempf
Default


Just a thought, but with a little research I bet you could get the CultureInfo.OptionalCalendars property to do some work for you.



Bill Sempf
Effective Visual Studio .NET
 
Old January 31st, 2005, 06:05 AM
Registered User
 
Join Date: Jan 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to ashoksmohanty Send a message via AIM to ashoksmohanty Send a message via MSN to ashoksmohanty
Default

In this tutorial we will consider our server is located in a different time zone from the one our clients are located at (A London related site is in a server located is USA for example).

First we must know the time in the server. We will create a text file with the code bellow, and we will copy it to our server:

Time in server: <% =time %>


Then we will visit our page and we will get the time in the server. In our case the output is this one

Time in server: 4:37:01 AM

Second, we will calculate the difference in hours between local time and time in server

In our example, in London the time is 10:37:01, so the difference between time in london and in server is six hours.

Finally we will get the code necessary to display the local time by adding 6 hours to server´s time.



Getlocaltime.asp
<%
thehour=Hour(now) + 6 ' Here we will add 6 to hour in server
if thehour>12 then
  thehour=thehour-12
end if
Theminute=minute(now)
if Theminute<10 then
  Theminute="0" & Theminute
end if
Thesecond=second(now)
if Thesecond<10 then
  Thesecond="0" & Thesecond
end if
%>
Local time: <% =thehour %>:<% =Theminute %>:<% =Thesecond %>

Output:
Local time: 10:37:01

Hope this will u.

With Best regards,
Ashok Mohanty



ASJB





Similar Threads
Thread Thread Starter Forum Replies Last Post
date and time in EST time zone anboss XSLT 1 May 21st, 2008 01:42 PM
time zone & day light time rajn ASP.NET 1.0 and 1.1 Professional 0 August 7th, 2007 05:02 PM
adjust zone time kherrerab BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 6 July 2nd, 2007 08:53 AM
Zone Time kherrerab BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 October 20th, 2006 12:30 PM
getting time zone nerssi Javascript 2 December 22nd, 2004 10:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.