Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

determin hours gone buy from now() 1

Status
Not open for further replies.

onressy

Programmer
Mar 7, 2006
421
CA
Hi i'm having a simple issue (for some) trying to determine how many hours have gone by, any suggestions? Thanks

Dim timeGone : timeGone = DateDiff("h","1/20/2007 1:36:09 PM",now())

response.write timeGone
 
Seems to work exactly as advertised for me. It gives the number of transitions from x:59:59 to x+1:00:00

If you want number of whole hours, then get the difference in minutes and do an integer division by 60
Code:
timeGone = DateDiff("n","1/21/2007 7:59:09 AM",now())\60

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
What sort of issue are you having? As johnwm says, it does what it says on the tin. Maybe the problem isn't with datediff. Have you tried
Code:
response.write cstr(timeGone)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top