codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  number of hours and minutes spent  diegoguintu at 10:03 on Monday, September 01, 2003
 

how can i get the no. of hours including the minutes and one hour lunch break should be automatically deducted .

for example

10:00 am to 12:00 pm
the answer should be 2 hours

another example
8:00 am to 1:00 pm
the answer should be 4 hours

what about this

8:00 am to 5:48 pm



  Re: number of hours and minutes spent  Jeff Anderson at 11:08 on Monday, September 01, 2003
 

Hi there
It's quite easy using the datediff function in ASP

<%mins=(DateDiff("n",time1,time2))%>

That will provide the minutes, so if you do something like the below you will be able to print out hours and minutes.

<%
'get the total number of minutes
mins=(DateDiff("n",time1,time2))

'now get the amount of hours in that, ignoring any left-over minutes
hours=cint(mins/60)

'now see if there are any extra minutes left-over

mins_left_over=mins-(hours*60)

'print the results
Response.write "The difference between the two times was " & hours & " hours and " & mins_left_over & " minutes "
%>





  Re: number of hours and minutes spent  amery buck at 12:50 on Friday, April 30, 2010
 

Ground shaking content i get form your blog. Very nice post about minutes spent. Thanks for your beneficial information about testking 70-528, testking 70-686 and testking 1z0-050 certifications. These are the best certifications in the world.

  Re: number of hours and minutes spent  Elain at 14:41 on Monday, November 08, 2010
 

It is wrong about "8:00 am to 1:00 pm- the answer should be 4 hours"? I think the answer should be 5!
And about another" 8:00 am to 5:48 pm", i think the answer shoule be 9.48 hour.
----------------------------------------------------------
flash banner | logo maker | flash menu








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: finding Field size
•  Re: Diplay uploaded files
•  Re: DHTML Menu
•  Re: A new Begining
•  Re: Playing Sound Waves
•  Re: welcome
•  Re: Create desktop icon
•  Re: how to write games on PDA
•  Stephen Arnold on real-time search


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2010