Quote:
Originally Posted by Old Pedant
I think we have to assume he stole...err...copied...a dateFormat() function from someplace.
|
Which will not help the next person coming here searching for an answer to the same question as there still isn't an actual complete solution to the question published.
Since none of the code here actually validates what the field contains at all the first step would be to validate that the field actually contains a date/time and to load that into an appropriate JavaScript variable using
new Date(). Then you can easily extract just the date portion using the appropriate methods.
Neither version of the code the OP posted would work if the person entered "noon yesterday" as their date and time even though the code they have would allow that input.