473,625 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calculate duration between two dates

archulu
34 New Member
hai
this is archulu. i am new to domapi.now my problem is in my project i am taken 2 domapi datepickers. what i am want Calculate duration between two dates which i am selected in that datepicker.

ex: two dates are selected from domapi are 29-04-2007 01-05-2007
i want result is duration between is 3days.i want result plz help to me
Apr 20 '07 #1
3 10738
mrhoo
428 Contributor
1.convert the two strings to two Date objects

2. subtract one from the other

3. divide the result by 86400000

4. round the result with Math.floor for whole days
Apr 20 '07 #2
anejamanish
3 New Member
hai
this is archulu. i am new to domapi.now my problem is in my project i am taken 2 domapi datepickers. what i am want Calculate duration between two dates which i am selected in that datepicker.

ex: two dates are selected from domapi are 29-04-2007 01-05-2007
i want result is duration between is 3days.i want result plz help to me

// calc to seconds
$datefrom = strtotime(29-04-2007, 0);
$dateto = strtotime(01-05-2007, 0);
// calc difference in seconds
$difference = $dateto - $datefrom;

if($difference> 86400)
{
// reformat to days
$datediff = floor($differen ce / 86400);
$unit='days';
echo $datediff.$unit ;
}
Apr 23 '07 #3
mrhoo
428 Contributor
javascript time stamps and differences are measured in microseconds
Apr 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1648
by: Guido | last post by:
How to cope with query output which provides all possible values based on a one to many relationship between two tables. I'm only interested in one answer per primary key in the 'one' table. I've tryed to filter out several values, but it does not work (because then also correct answers are lost) or still 'double' or wrong answers appear. In the many table, there are records which are not necessary for my query (or calcultions), but they...
0
6590
by: Tu-Thach | last post by:
TimeSpan span = aEnd.Subtract(aStart); System.Console.WriteLine(span.TotalMilliseconds); Tu-Thach >-----Original Message----- >I want to calculate the time it takes to execute a function is there a >datediff function? >
0
1818
by: 3skmult | last post by:
i wanna calculate the days beteween the two years ..
2
2152
by: David | last post by:
Hi, I need to display 3 fields with future dates (Fridays only) as table column headers. i.e. 16th Feb | 23rd Feb | 2nd March. As each week passes, i.e. from the Saturday, the dates should move accross 1, i.e. column 1 will update to 23rd Feb, Column 2 to 2nd March and Column 3 to 9th March.
3
4396
archulu
by: archulu | last post by:
hai this is archulu. i am new to domapi.now my problem is in my project i am taken 2 domapi datepickers. i want to Calculate duration between two dates which i am selected in that datepicker. ex: two dates are selected from domapi are 29-04-2007 01-05-2007 i want result is duration between is 3days.i want result plz help to me note : i am writing this program in perll with unix.
1
1516
by: Rajasekar09 | last post by:
hi am beginner of SQL , i hav some doubt in SQL Query Between Command.. i want to calculate two dates using between command.. example of the Query is: SELECT LI.EmpId,EOS.Emp_Name,DS.Description,SUM(convert(int, DateDiff (Day,'10/03/2007','11/11/2007'))+1) as Leave,LS.NoOfLeaves, (LS.NoOfLeaves -SUM((convert(int, DateDiff (Day,'10/03/2007' , '11/10/2007'))+1)))
13
15021
by: nma | last post by:
Hi How do I clculate time duration if I have a column like this 2008-04-19 15:00:55.000 2008-04-19 15:01:07.000 2008-04-19 16:33:55.000 2008-04-19 16:35:07.000 2008-04-19 16:37:00.000 2008-04-19 16:37:01.000
5
1906
by: Jason7899 | last post by:
hi, any one know a software to list the dates of the next changes of the daylight for example: in next 24-10-2009 the hour will change for less hour thanks for your help :)
5
2942
by: Mirku | last post by:
Hello! I have a table in a database where there is a column called DATE (datetime type)that logs the date/time of an event.The first index of the table it represent the start date/time and the last index of the table represent the final date/time. How can i make a query that returns the duration between the start date/time and final date/time? i tryed to do: select DateDiff(hour,select DATE from mytable where INDEX=(select min(INDEX) from...
0
8189
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4192
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1499
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.