javascript - How to validate user input is current date and time? -
in html use ext.net datefield
<ext:datefield runat="server" id = "date" format="y-m-d hh:mm:ss" submitformat="y-m-d h:i:s" marginspec="0 0 0 60" fieldlabel="gate in date/time" allowblank="false" indicatortext="*" indicatorcls="red-text"/>
when view shows correct date time 12:00:00.in javascript
var iframeid = $('iframe').attr('id'); var mydate = lazymethod_get(iframeid, "formdetail", "date") var today = new date().toisostring().slice(0, 10); alert(mydate); alert(today); if (mydate > today) { alert("entered date greater today's date "); } else { alert("entered date less today's date "); }}
the validation alert date entered less today date. want validate date , time if user insert example 2016-02-03 date wrong , current date.
thank you.
time in microseconds.
if (!date.now) { date.now = function now() { return new date().gettime(); }; }
do formatting after calculations.
what lazymethod_get() workings. returning string, or date object.
Comments
Post a Comment