Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 10th, 2008, 01:56 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default Generic Date Calculation

Hi All,

I am working on a project where I am creating records depending on the date range chosen, Option Chosen and the pattern chosen.

By pattern I mean -> Daily,Weekly, Monthly, Yearly.
Date Range -> Start Date & End Date
Option Chosen -> Any numeric No. ex. 1,2,3,4

There are javascript validations to check the validity of the Option & Pattern against the Date Range.

How it Works
------------

1. I have chosen 'Monthly' Option
2. I have chosen '2' as Option which means every 2 Months
3. Start Date = 10/04/2008 End Date = 11/05/2008

This should give me a validation message:
"Date Range does not match Pattern and Option Chosen."

Reason: Since I have chosen for every 2 months means date range should be >= 2 * No. of days in the 2 months. Since date range between 10/04/2008 - 11/05/2008 is only 30 days which is less than 60 days no records would be created.

I need a generic javascript function where I can pass the Pattern & Option & Start Date as parameters and the function would return me the total days as numeric value. This I can use to compare with the total gap in days between the Date range Chosen.

Kindly Help !!!





Similar Threads
Thread Thread Starter Forum Replies Last Post
unclear use of generic types raghavshukla Pro Java 1 March 5th, 2009 03:14 AM
How can i make this generic girija45701 C# 0 November 29th, 2008 04:32 AM
Generic List error ferahl C# 2 October 30th, 2007 03:28 AM
Date Range Calculation connbound SQL Server 2000 2 October 5th, 2005 08:22 AM
Query based on date calculation? skinny Access 5 September 30th, 2003 03:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.