Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date Comparisons
Message
De
05/01/2006 10:25:41
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
 
 
À
Tous
Information générale
Forum:
Internet
Catégorie:
Javascript
Titre:
Date Comparisons
Divers
Thread ID:
01083547
Message ID:
01083547
Vues:
64
I think the two alerts below should have the same value, but they are slightly different. The begtrandate variable is in the format mm/dd/yyyy and the mintrandate is in the default (time?) format. What I really need to do is set the mintrandate variable to the current date minus a certain number of days (or full years, preferably). I'm reasonably new to Javascript and can't seem to find the right solutions online for this. Looks like I'll be doing a fair amount more in the near future, so any help or resources are appreciated.
		//Set the two dates to compare
		var mintrandate=new Date();
		var begtrandate=new Date(document.ERLiabHis.BegTranRange.value);

		alert("Beg: " + begtrandate.getTime());
		alert("Min: " + mintrandate.getTime());

		if (begtrandate.getTime() < mintrandate)
		{
          mvalid = "f";
		  alert("The Start Date must be no more than 2 years prior to today's date.");
	      document.ERLiabHis.BegTranRange.focus();
	      document.ERLiabHis.BegTranRange.select();
	      event.returnValue=false;
          return false;
		}
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform