Compare user date with system date

R

Robert Scheer

Hi.

My user types a date on a textbox using the DD/MM/YYYY format. I need
to verify that this date is not older than 2 months ago. Have seen
some functions to test dates but not with the above format.

Thanks,
Robert Scheer
 
D

Dr John Stockton

JRS: In article <[email protected]>,
dated Mon, 19 Jul 2004 19:13:56, seen in
Robert Scheer said:
My user types a date on a textbox using the DD/MM/YYYY format. I need
to verify that this date is not older than 2 months ago. Have seen
some functions to test dates but not with the above format.

Did you not find the newsgroup FAQ sufficiently helpful?

See below.



YYYY/MM/DD would be better; if you are sure that the form will be either
DD/MM/YYYY or YYYY/MM/DD, then the following will convert the former to
the latter if needed - I think :-

S = S.replace(/^(\d\d)\/(\d\d)\/(\d\d\d\d)$/, "$3/$2/$1")

You will need to think about "two months ago" for Aug 31 and for April
29; if you have authority, it would be easier to use 60 days.

Do not let the result be adversely affected by Summer Time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top