Search for:
Jump to: 
Your Ad Here
Post new topic Reply to topic
Author Message
 Post subject: calculating total days between two dates in javascript
PostPosted: Wed Jun 29, 2011 4:12 am 
Offline

Joined: Tue May 13, 2008 3:43 am
Posts: 213
hi Friends,

Calculating total dates between two dates using javascript , Please follw the below code.
<html>
<head>
<script>
function calculate()
{
var Date_Accident='01/01/2011';
var Date_Debriefing='31/12/2011';
var t1=Date_Accident;
var t2=Date_Debriefing;
var one_day=1000*60*60*24;
var x=t1.split("/");
var y=t2.split("/");
var date1=new Date(x[2],(x[1]-1),x[0]);
var date2=new Date(y[2],(y[1]-1),y[0])
var month1=x[1]-1;
var month2=y[1]-1;
numberofDays=Math.ceil((date2.getTime()-date1.getTime())/(one_day));
alert(numberofDays);
}
</script>
</head>

<body onload="calculate();">
</body>
</html>

Thank You.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic    [ 1 post ] 

1, 2, 3, 4, 5 ... 414
Recent topics  Replies   Views   Last post 
No new posts Add Slide Notes & Images as Logos in MS PowerPoint

by aspose » Tue May 21, 2013 4:03 am in Miscellaneous

0

15

Tue May 21, 2013 4:03 am

aspose View the latest post

No new posts Jquery ajax Pagination using php

by rajkumar » Tue Apr 19, 2011 11:14 am in Coding Repository

8

17615

Mon May 20, 2013 2:46 am

gfsdfg View the latest post

No new posts Ecommerce website development and website Design

by iweballey » Fri May 17, 2013 7:15 am in PHP-Code Help

0

300

Fri May 17, 2013 7:15 am

iweballey View the latest post

No new posts How to upgrade and migrate Joomal site

by mallikharjuna rao » Mon Jan 21, 2013 1:40 pm in Joomla

1

356

Thu May 16, 2013 9:53 am

sunitha12 View the latest post

No new posts Benefits of PHP

by hirephpexpert » Fri Sep 07, 2012 4:41 am in CakePHP

6

1598

Wed May 15, 2013 6:25 am

PrettyPrincesG View the latest post


Your Ad Here