Get local time

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: 9:52:14 AM

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

In our example, in London the time is Local time: 3:52:14 , 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 %>



Google






   



MSN Nick Name



More Resources...





Most Viewed Services:
  1. HTML Tutorial
  2. XHTML Tutorial
  3. CSS Tutorial
  4. Javascript Tutorial
  5. DHTML Tutorial
  6. VB Script
  7. TCP/IP Tutorial
  8. ADO Tutorial
  9. MYSQL Tutorial
  10. ASP Tutorial
  11. AJAX Tutorial
  12. CFML Tutorial
  13. PHP Tutorial
  14. WML Tutorial
  15. FLASH Tutorial
  16. XML Tutorial
  17. RSS Tutorial
  18. SQL Tutorial
  19. HTML Articles
  1. Javascript Articles
  2. PHP Articles
  3. SEO Articles
  4. Web Design Articles
  5. SEO Tips
  6. Web Design Tips
  7. Articles
  8. CSS
  9. CSS Tips
  10. HTML Tips
  11. JAVASCRIPT Tips
  12. MYSQL Tips
  13. PHP Tips
  14. Money
  15. Tutorials
  16. Web Hosting



  • Home
  • Web Directory
  • Top Directoriers
  • Webmaster Directories
  • Contact
  • © Copyright 2006-2010 All Rights Reserved By CodeDcode.Com : HTML : RSS : TEXT : XML