Hi,
I get two dates in the format 27/07/2006 from two fields (checkindate,chackoutdate) and I want to calculate the difference in days between them... Can you help?
13 2327
Hi,
I think the following code solves ur problem -
-
-
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-
<html xmlns="http://www.w3.org/1999/xhtml" >
-
<head runat="server">
-
<title>Untitled Page</title>
-
<script type="text/javascript">
-
function find()
-
{
-
var string=document.form1.Start.value;
-
var string1=document.form1.end.value;
-
var day=string.substring(0,2);
-
var month=string.substring(3,5);
-
var year=string.substring(6,string.length);
-
var day1=string1.substring(0,2);
-
var month1=string1.substring(3,5);
-
var year1=string1.substring(6,string.length);
-
-
var startingdate=new Date(year,month-1,day);
-
alert(startingdate);
-
var finishingdate=new Date(year1,month1-1,day1);
-
alert(finishingdate);
-
var one_day=1000*60*60*24 ;
-
document.form1.result.value=
-
Math.floor((finishingdate.getTime()-startingdate.getTime())/(one_day));
-
}
-
-
-
</script>
-
</head>
-
<body>
-
<form id="form1" runat="server">
-
<div>
-
<input type="text" name="Start" />
-
<input type="text" name="end" />
-
<input type="button" name="sub" value="Find No:of days" onclick="find()" />
-
<input type="text" name="result" />
-
-
</div>
-
</form>
-
</body>
-
</html>
-
-
-
-
Hi,
I get two dates in the format 27/07/2006 from two fields (checkindate,chackoutdate) and I want to calculate the difference in days between them... Can you help?
I have made some modifications and the script resulted to the following -
<SCRIPT type=text/javascript>
-
var string=^Check_In_Date^;
-
var string1=^Check_Out_Date^;
-
var day=string.substring(0,2);
-
var month=string.substring(3,5);
-
var year=string.substring(6,string.length);
-
var day1=string1.substring(0,2);
-
var month1=string1.substring(3,5);
-
var year1=string1.substring(6,string.length);
-
var startingdate=new Date(year,month-1,day);
-
alert(startingdate);
-
var finishingdate=new Date(year1,month1-1,day1);
-
alert(finishingdate);
-
var one_day=1000*60*60*24 ;
-
var result=Math.floor((finishingdate.getTime()-startingdate.getTime())/(one_day));
-
document.write(result);
-
</SCRIPT>
-
When i run it I get the following message..
Object does not support this property or method
hi ,
what is that ^check_in_date^
if it is the textbox then give it as document.formname.check_in_date.value
ok
I have made some modifications and the script resulted to the following
<SCRIPT type=text/javascript>
var string=^Check_In_Date^;
var string1=^Check_Out_Date^;
var day=string.substring(0,2);
var month=string.substring(3,5);
var year=string.substring(6,string.length);
var day1=string1.substring(0,2);
var month1=string1.substring(3,5);
var year1=string1.substring(6,string.length);
var startingdate=new Date(year,month-1,day);
alert(startingdate);
var finishingdate=new Date(year1,month1-1,day1);
alert(finishingdate);
var one_day=1000*60*60*24 ;
var result=Math.floor((finishingdate.getTime()-startingdate.getTime())/(one_day));
document.write(result);
</SCRIPT>
When i run it I get the following message..
Object does not support this property or method
I have never seen ^ used that way.
It is used by foxrpro. It is an HTML document that is created from the database and ^Check_In_Date^ refers to a certain field.
Maybe I'm writing sth that may never work.
When the program executes and the page created this field is substituted by 27/07/2006
hi,
is that program running or same error u r getting
When the program executes and the page created this field is substituted by 27/07/2006
Let me see All of your pages code please wrap it up with [ CODE] and [ /CODE] and we will get it figured out for you.
- <SCRIPT type=text/javascript>
-
var string=^Check_In_Date^;
-
var string1=^Check_Out_Date^;
-
var day=string.substring(0,2);
-
var month=string.substring(3,5);
-
var year=string.substring(6,string.length);
-
var day1=string1.substring(0,2);
-
var month1=string1.substring(3,5);
-
var year1=string1.substring(6,string.length);
-
var startingdate=new Date(year,month-1,day);
-
alert(startingdate);
-
var finishingdate=new Date(year1,month1-1,day1);
-
alert(finishingdate);
-
var one_day=1000*60*60*24 ;
-
var result=Math.floor((finishingdate.getTime()-startingdate.getTime())/(one_day));
-
document.write(result);
-
</SCRIPT>
hi,
by writing ^Check_In_Date^ is the value is assigned to the string once place an alert box after string="^Check_In_Date^
alert(string) - <SCRIPT type=text/javascript>
-
var string=^Check_In_Date^;
-
var string1=^Check_Out_Date^;
-
var day=string.substring(0,2);
-
var month=string.substring(3,5);
-
var year=string.substring(6,string.length);
-
var day1=string1.substring(0,2);
-
var month1=string1.substring(3,5);
-
var year1=string1.substring(6,string.length);
-
var startingdate=new Date(year,month-1,day);
-
alert(startingdate);
-
var finishingdate=new Date(year1,month1-1,day1);
-
alert(finishingdate);
-
var one_day=1000*60*60*24 ;
-
var result=Math.floor((finishingdate.getTime()-startingdate.getTime())/(one_day));
-
document.write(result);
-
</SCRIPT>
Can you explain? I did not understand
hi,
place the code so that u check it
var string=^Check_IN_Date^;
alert(string)
Can you explain? I did not understand
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Harag |
last post by:
Hi All
I currently thinking of converting from my little knowledge of
VBscript to jScript ASP.
With this in mind I'm looking at my current code to see how it will
convert over to Jscript.
...
|
by: John Bentley |
last post by:
Note this is crossposted to comp.lang.javacript and
microsoft.public.dotnet.scripting.
After some Googling and FAQing my understanding of these terms is, crudely:
Javascript (3 different...
|
by: Jim H |
last post by:
I have an app I working on that was working fine a few days ago. Now I get
a jscript error:
Microsoft JScript runtime error: Object expected
in a part of the code that has not been modifed or...
|
by: TdJ |
last post by:
Hi guys,
I am trying to build a dialog box that does the same as an "alert" but with
out the exclamation mark graphic (which is causing some users to think
something has gone wrong !?
I have...
|
by: moondaddy |
last post by:
I'm using vb.net and have an aspx page where I want to call a function in
the code behind to do something on the backend and I want to call this
function from a jscript function in the aspx page. ...
|
by: Alex Nitulescu |
last post by:
Hi. I have a header implemented as a user control (ascx). On start-up, I
show the date/time (in a label named "lblTimer") like this:
<html>
.......
<span....
<%=Now.ToShortDateString() %> -...
|
by: JNariss |
last post by:
Hello,
I have created a connection to my Access database with Dreamweaver and
made a simple form with 4 fields.
The code behind this form was/is:
<%@LANGUAGE="VBCRIPT" CODEPAGE="1252"%>...
|
by: Jer425 |
last post by:
Hello,
I'm coding in VB and trying to include a jscript file. This will not
work because you can only use one language in asp.net. Is there a way
that I can use the jscript without having to...
|
by: finditajr |
last post by:
Hello
I'm having the following problem:
My main webpage calls a function stored in a .js file that creates an HTML window to display a calendar. Whenever I click on a date in that calendar,...
|
by: Arhaus |
last post by:
I was wondering if someone could help me out. I am new to jscript and I need to modify a calendar onclick event. We have a calendar which displays the dates either in green or red based upon data...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
| |