Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> date checking ???

date checking ???

From: Andrea Oracle <andreaoracle_at_yahoo.com>
Date: Wed, 20 Aug 2003 14:49:25 -0800
Message-ID: <F001.005CBD11.20030820144925@fatcity.com>


Hi all,

May I ask a javascript question?? (sorry to post here!) below is a form checking input date. The input date cann't be earlier than today. But it also compares hours and minutes which I don't want. Suppose you input 08/20/2003, it thinks it's 08/20/2003 00:00:00 which is earlier than now (08/20/2003 15:30:00). How to solve this?? Thank you!

<html>
<head>
<script>

function validate(){
 var obj = document.forms("shipping");  

 //$$ sending date cannot be earlier than today

          now = new Date();
          sDate = obj.p_sending_date.value;
          sDate = sDate.substring(0,2) + "/" +
sDate.substring(3,5) + "/" + sDate.substring(6,10);

   inputDate = new Date(sDate);

          if (inputDate < now) {
             alert("Sending date cannot be earlier
than today.");
             
   }else{
             alert("ok");
          }

}
</script>
</head>
<body>
<form name="shipping">
<input type=text name="p_sending_date">
<input type=submit value="submit"

onClick="validate();">
</form>
</body>
</html>
 

Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Andrea Oracle
  INET: andreaoracle_at_yahoo.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Aug 20 2003 - 17:49:25 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US