473,405 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Date Interval Functions

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
1 5309
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Graeme Longman | last post by:
Hi everyone, I was wondering if anyone has written some Python code which uses a start date and end date and a given interval (day, month or year) and outputs all the time periods for that range...
2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
4
by: Lynn | last post by:
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...
7
by: meltedown | last post by:
Why doesn't this return anything ? SELECT DATE_SUB('FROM_DAYS(TO_DAYS(2005-09-28 18:04:19))', INTERVAL 6 DAY)
0
by: UBI | last post by:
Vorrei suggerire una funzione completa per la differenza fra due date. (questo č codice freeware, niente di illegale) La funzione seguente permette il calcolo di una differenza precisa tra due...
7
by: Big Tony | last post by:
I have a piece of code written in VS.NET 2003. It runs fine on one machine and does not on another. It throws an invalid cast exception. Any idea why there is a difference between machines? Dim...
3
by: IntraRELY | last post by:
I have the following function, Notice how I am passing the dateInterval as a string. What is the correct way to pass "DateInterval.Year" as a variable to a function? TIA, Steve Wofford...
0
by: Lee Harr | last post by:
I wrote a function to return the first date of a given week (and a few related functions) : -- return the first date in the given week CREATE or REPLACE FUNCTION week_start(integer, integer)...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
3
by: Reg143 | last post by:
Hi all, The code below loops from a starting date, incrementing the date and displaying date and day-of-week. Everything is fine until 2007-11-04 is reached. Any help would be appreciated. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.