Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Formatting time
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Formatting time

 Post Reply Post Reply
Author
adnan248999 View Drop Down
Newbie
Newbie
Avatar

Joined: 30 November 2003
Location: United Kingdom
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote adnan248999 Quote  Post ReplyReply Direct Link To This Post Topic: Formatting time
    Posted: 30 November 2003 at 8:17pm

Right I have come across people on neowin.net asking how to do this too so here it is. Adding a specfied number of hours to a time value.

Let's say we wanted to display the time adding 2 hours an 4 minutes we'd do this:

<%

response.write(Time()+2/24+4/1440)

%>

And thats it we add 2 divided by the number of hours in a day then add 4 minutes divided by the number of minutes in a day which is 1440 hope this help anyone who ever wanted ot know how to do this.

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 30 November 2003 at 8:48pm

DateAdd function will do the trick: DateAdd("N",124,Now())

and if you wanted now + 2hr and 4 mins, you would just add 124 mins

Contribute to the working anarchy we fondly call the Internet
Back to Top
adnan248999 View Drop Down
Newbie
Newbie
Avatar

Joined: 30 November 2003
Location: United Kingdom
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote adnan248999 Quote  Post ReplyReply Direct Link To This Post Posted: 01 December 2003 at 5:13am
Originally posted by MorningZ MorningZ wrote:

DateAdd function will do the trick: DateAdd("N",124,Now())

and if you wanted now + 2hr and 4 mins, you would just add 124 mins

Cool didn't know about the DateAdd function thanx for that

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.