Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Date() Time() Function help


  • Please log in to reply

#1
Immortalarena

Immortalarena

    Member

  • Member
  • PipPipPip
  • 211 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
  • 211 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
  • 211 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