Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Writing the current day and time
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Writing the current day and time

 Post Reply Post Reply
Author
betheball View Drop Down
Newbie
Newbie


Joined: 28 April 2002
Location: United States
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote betheball Quote  Post ReplyReply Direct Link To This Post Topic: Writing the current day and time
    Posted: 23 August 2003 at 12:42pm

This will be simple for many of you, but I am very much a VB and ASP rookie.  I want to display on my page the current day of the week and time.  I know how to use

<% Response.write Now() %>

But my server is 2 hours ahead of me.  How do I write my code to display the current time as two hours earlier than the server time.  Also, what is the format so it displays like this example:

Saturday, 12:40 PM

Meaning, I just want the day of the week and I don't want to display the seconds portion of the current time.

Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 23 August 2003 at 5:26pm
try searching google for "ASP date and time functions"
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 23 August 2003 at 5:34pm
<%
servertime = now()
mytime = Dateadd("h",-2, servertime)
Response.Write mytime & "<br>"
Response.Write Formatdatetime(mytime, vblongdate)
%>
Back to Top
b_bonnett View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Location: New Zealand
Status: Offline
Points: 275
Post Options Post Options   Thanks (0) Thanks(0)   Quote b_bonnett Quote  Post ReplyReply Direct Link To This Post Posted: 23 August 2003 at 5:46pm

Click here for info on how to use the DateAdd function to add or subtract intervals of time from a date.

Click here for info on how to use the FormatDateTime function to format the date/time to how you want it.

Blair

Webmaster, The Plane Gallery
Greetings From Christchurch
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.