By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,607 Members | 1,978 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,607 IT Pros & Developers. It's quick & easy.

Date Interval Functions

P: n/a
On a form I have

Date_Start Date_End

I have a new
Date_Start1 Date_End1 which the use
inputs.

I need to validate that Date_Start1 and Date_End1 are a date range
entirely separate from Date_Start and Date_End i.e. no overlapping
whatsoever. In effect checking a date interval.

Are there any functions out there already written that can do this? It
seems to basic to start comparing and contracting dates! Would like to
do it in Javascript, but happy in vbscript also.

Thanks,
Lynn
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
JRS: In article <1d**************************@posting.google.com >, seen
in news:comp.lang.javascript, Lynn <ru******************@hotmail.com>
posted at Mon, 16 Feb 2004 09:06:17 :-
On a form I have

Date_Start Date_End

I have a new
Date_Start1 Date_End1 which the use
inputs.

I need to validate that Date_Start1 and Date_End1 are a date range
entirely separate from Date_Start and Date_End i.e. no overlapping
whatsoever. In effect checking a date interval.
Firstly validate the dates and convert them to Date Objects.
Check that Start < End and Start1 < End1.
Check that End < Start1 or End1 < Start.
That can be done by direct comparison of Objects.

If your dates are in the sensible International Standard form, then it
is not necessary to use Date Objects; just compare strings in YYYYMMDD
YYYY-MM-DD or YYYY/MM/DD forms.

If your dates are in numeric form without leading zero, e.g. 23/4/1564
or 23/4/1616, you can use a RegExp to remedy that.

If your dates lack, or may lack, the upper two digits of the year, you
can use a RegExp to remedy that.

If your dates are in a known non-standard order, you can use a RegExp to
remedy that.

Are there any functions out there already written that can do this? It
seems to basic to start comparing and contracting dates! Would like to
do it in Javascript, but happy in vbscript also.


See below.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/vb-dates.htm> VB maths, dates, sources.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.