|
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
|
|
|
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 "
%>
|
|
|
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.
|
|
|
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
|
|
|
|
|
|
|
|