Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Date() Time() Function help


  • Please log in to reply

#1
Immortalarena

Immortalarena

    Member

  • Member
  • PipPipPip
  • 216 posts
I am working with ASP, and I need to know how to get the date/Time from the server. Problem is that the server is off by 2 hours.

Here is the current code:
<% Response.Write ("The time on the server is: " & Date())
Response.Write (", " & Time()) %>

I need to add three hours to the time on the server so that when I call the date or time, I can get the correct information. Thanks,

-Matt :)
  • 0

Advertisements


#2
gunner12

gunner12

    Member

  • Member
  • PipPip
  • 46 posts
Did you want to add 2 or 3 hours?

Heres with 3 hours added.

<%
Response.Write ("The time on the server is: " &DateAdd("h",3,Now())
%>

This will display the date and time plus 3 hours.

Let me know if thats what you wanted or if you want it to look different.

Edited by gunner12, 04 January 2008 - 05:17 AM.

  • 0

#3
Immortalarena

Immortalarena

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 216 posts
That worked. I will at a later time just be returning the date, without the time on it. What would I amend to just show the date? Thanks!
  • 0

#4
gunner12

gunner12

    Member

  • Member
  • PipPip
  • 46 posts
You coud use half of what you started with:

<%
Response.Write ("The Date on the server is: " &Date())
%>

  • 0

#5
Immortalarena

Immortalarena

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 216 posts
Thanks, I was hoping I could keep the addition of the 3 hours because if you post late the date could be off by 1 day, but I'm sure the group can live with it. Thanks again for all the help! :)
  • 0

#6
gunner12

gunner12

    Member

  • Member
  • PipPip
  • 46 posts
No probelm, glad I could be of help! :)
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP