Subtração De Duas Datas
#1
Posted 05/02/2006, 00:43
Preciso fazer a subtração de duas datas, ou seja dois campos, DATA1 E DATA2, mais ou menos assim...
eu digito a 'data1' = 01/01/2006
e digito a 'data2' = 01/01/2007
o que eu preciso é que me mostre quantos dias tem entre estas datas, ou seja...
DATA2 - DATA1 = 01/01/2007 - 01/01/2006
e apresenta em um campo abaixo...
NUMERO DE DIAS : 365
isso que preciso, se alguem puder me ajudar, desde já grato, um abraço.
- Miguceamma likes this
atendimento@wlsistemas.com
Wendel Lopes - Diretor
#2
Posted 06/02/2006, 07:30
Olha.. Provavelmente já existem diversos tópicos aqui no forum que respondem a esta questão. É bom dar uma procurada antes de perguntar, ok?
function difDate(data1,data2) { var d1=new Date(data1.substr(6,4), data1.substr(3,2)-1, data1.substr(0,2)); var d2=new Date(data2.substr(6,4), data2.substr(3,2)-1, data2.substr(0,2)); return Math.ceil((d2.getTime()-d1.getTime())/1000/60/60/24); }
Um abraço,
Thales Medeiros.
#3
Posted 06/02/2006, 22:28
atendimento@wlsistemas.com
Wendel Lopes - Diretor
#4
Posted 06/02/2006, 23:10
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Valor do cheque</title>
</head>
<script type="text/javascript" language="javascript" src="datetimepicker.js"></script>
<script language="JavaScript">
<!--
if (document.images)
{
calimg= new Image(16,16);
calimg.src="images/cal.gif";
}
//-->
</script>
<body>
<script language="JavaScript">
function soma(){
document.getElementById("numdias").value = '0'
document.getElementById("parcial").value = '0'
document.getElementById("total").value = '0'
var preco = parseFloat(document.getElementById("preco").value);
var juros = parseFloat(document.getElementById("juros").value);
var datacheque = parseFloat(document.getElementById("datacheque").value);
var dataatual = parseFloat(document.getElementById("dataatual").value);
var teste = difDate(datacheque, dataatual);
document.getElementById("numdias").value = teste;
document.getElementById("parcial").value = (datacheque - dataatual) / 30 * juros;
document.getElementById("totaljuros").value = preco-((100 - (((datacheque - dataatual) / 30) * juros)) * preco / 100);
document.getElementById("total").value = (100 - (((datacheque - dataatual) / 30) * juros)) * preco / 100;
}
</SCRIPT>
</head>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<form method="POST" action="">
<tr>
<td width="18%">
<p style="margin-left: 15"><font face="Arial" style="font-size: 8pt">Valor
do cheque :</font></td>
<td width="82%"> <input type="text" id="preco" value="0" size="20"></td>
</tr>
<tr>
<td width="18%">
<p style="margin-left: 15"><font face="Arial" style="font-size: 8pt">Data
atual :</font></td>
<td width="82%">
<input type="Text" id="demo1" maxlength="25" size="9"><a href="java script:NewCal('demo1','ddmmyyyy')"><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
</td>
</tr>
<tr>
<td width="18%">
<p style="margin-left: 15"><font face="Arial" style="font-size: 8pt">Data
cheque :</font></td>
<td width="82%">
<input type="Text" id="demo2" maxlength="25" size="9"><a href="java script:NewCal('demo2','ddmmyyyy')"><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
</td>
</tr>
<tr>
<td width="18%">
<p style="margin-left: 15"><font face="Arial" style="font-size: 8pt">Taxa de
Juros :</font></td>
<td width="82%">
<select size="1" onblur="soma()" id="juros">
<option>selecione...</option>
<option value="4">4%</option>
<option value="5">5%</option>
<option value="6">6%</option>
<option value="7">7%</option>
<option value="8">8%</option>
<option value="9">9%</option>
<option value="10">10%</option>
</select></td>
</tr>
<tr>
<td width="18%">
<p style="margin-left: 15"><font face="Arial" style="font-size: 8pt">Dias :</font></td>
<td width="82%"><b> <input type="text" id="numdias" size="20"></b></td>
</tr>
<tr>
<td width="18%">
<p style="margin-left: 15"><font face="Arial" style="font-size: 8pt">Juros
do período :</font></td>
<td width="82%"><b> <input type="text" id="parcial" size="2" maxlength="4"></b></td>
</tr>
<tr>
<td width="100%" colspan="2"><hr size="1">
</td>
</tr>
<tr>
<td width="18%">
<p style="margin-left: 15"><font face="Arial" style="font-size: 8pt">Total juros :</font></td>
<td width="82%">
<b><input type="text" id="totaljuros" size="20"></b></td>
</tr>
<tr>
<td width="18%">
<p style="margin-left: 15"><font face="Arial" style="font-size: 8pt">Total líquido
:</font></td>
<td width="82%">
<b><input type="text" id="total" size="20"></b></td>
</tr>
<tr>
<td width="18%">
</td>
<td width="82%">
</td>
</tr>
<tr>
<td width="100%" colspan="2">
<input type="reset" value="Novo calculo" name="B2"></td>
</tr>
</form>
</table>
</body>
</html>
Edição feita por: wendel, 06/02/2006, 23:10.
atendimento@wlsistemas.com
Wendel Lopes - Diretor
#5
Posted 07/02/2006, 06:58
<script> function difDate(data1,data2) { var d1=new Date(data1.substr(6,4), data1.substr(3,2)-1, data1.substr(0,2)); var d2=new Date(data2.substr(6,4), data2.substr(3,2)-1, data2.substr(0,2)); alert( Math.ceil((d2.getTime()-d1.getTime())/1000/60/60/24) ); } </script> <form name="form" action="" method="POST"> Data 1: <input type="text" name="data1" value="01/08/2005"><br /> Data 2: <input type="text" name="data2" value="07/02/2006"><br /> <input type="button" value="sub" onclick="difDate(document.form.data1.value,document.form.data2.value);"> </form>
chamei-o pelo evento onclick co botão, e retornei um alerta... vc muda para o q vc quiser..
Flws...
Até mais
#6
Posted 18/09/2017, 05:26
Viagra En Generique Propecia Vom Hausarzt Propecia Estrogenos
Viagra Bestellen Dhl <a href=http://cialtobuy.com>cialis</a> 2095 Albuterol Inhaler
Cialis Active Over The Counter cialis Prices Of Viagra
Canadian Pharmacy Accutan
Viagra Efectos Secundarios Pros Y Contras <a href=http://cialtobuy.com>cialis</a> Buy Cialis With No Perscription
#7
Posted 05/10/2017, 21:48
Adult Dose Amoxicillin viagra Levitra Online Buying Europe 247 Overnightpharmacy Com
Toronto Drug Store Pharmacy Propecia Does It Work Hair Growth Chewable Viagra cialis buy online Can I Purchase Elocon 5g
#8
Posted 02/11/2017, 23:11
Comprime Cytotec Acheter Du Cialis Viagra Sale No Prescription generic viagra Where To Buy Acticin Cialis Vente France Pharmacy Online Med
#9
Posted 03/11/2017, 06:30
Discounts! best retail products
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).
READ MORE
Neoprene rubber belt drawing abdomen slimming cummerbund female thin body shaping waisttrainer black purple 4 color ( 24.97 $)
Mini black outdoor camping wallet knife credit card knife folding safely pocket campng knife tactical rescue ( 1.50 $)
Leten Fantasy Series 3 Dual Engine 10 Modes Vibration Electric Hip Male Masturbator w Strong Sucker, Men Adult Erotic Sex Toys ( 28.99 $)
Trump: New immigration order will be tailored
аккаунт origin +с battlefield 1
counter strike global offensive скачать торрент бесплатно
nike air force special field отзывы
Babe wire black leather womens sneaker ( 240.72 $) DSquared2
6pcsLOT BGA Precision ESD Tweezers Set, stainless steel anti-static tweezers Repair Tool Soldering Station Welding Assist ( 5.50 $)
Yuyue YY - 22 6 Hole Clarinet ( $2.75 )
купить обувь кеддо +в интернет магазине
Online toy store Toy.ru â buy baby toys at low prices with delivery to Russia
леомакс магазин
Chic rhinestoned v-shaped ring for women ( 5.01 $)
Alluring halter pure color string bikini set for women ( 10.91 $)
#10
Posted 25/11/2017, 08:43
Buy Zoloft Uk Online Lasix 40 mg levitra Cialis Generico Dosaggio What Are The Side Effects Of Zithromax Xenical Online Cheap
Antibiotics Without Prescription Canada Tadalafil Generico Prezzo Farmacia generic cialis Abortion Pill Fast Delivery
Cialis India Pharmacy Side Effect Of Keflex In Dogs cialis Rx Elife Keflex In Renal Impairment Comprar Viagra Sin Receta Contrareembolso
Kamagra Suisse Cetazolin And Keflex Suche Viagra Ch viagra Get Fluoxetine Pragmaten Ups Propecia Ways To Take Amoxil 500 Mg
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)