[thelist] JS Snippet needed
CDitty
mail at redhotsweeps.com
Tue Aug 5 15:41:45 CDT 2003
I think this is what I need, but I have a question..... Since I am
comparing the date microtime(seconds), won't I need to compare it in
seconds too? Won't the different always be less if I don't? ie.....now
is/was 1060115992818. If I compare that to the diff with is 2, it will
always be less than that.. Just asking for clairfication to make sure my
brain is screwed on correctly today. :)
Chris
At 01:52 PM 8/5/2003, you wrote:
>function compareDates(date, min, max)
>{
> var now = new Date().getTime();
> var then = new Date(date).getTime();
> var diff = (then - now) / 86400000;
> var valid = true;
> if (diff <= min || diff >= max) {
> return true;
> }
> return valid;
>}
>
>Is that what you're looking for?
>
>You pass it any valid date...
>
>new Date("Month dd, yyyy hh:mm:ss")
>new Date("Month dd, yyyy")
>new Date(yy,mm,dd,hh,mm,ss)
>new Date(yy,mm,dd)
>new Date(milliseconds)
>
>And you pass it the least days and the most days and it returns true or
>false...
>
>Christopher Ditty wrote:
>>Does anyone have a javascript snippet that checks if a date is within X
>>number of days? ie....Date must be atleast 2 days out and no farther
>>than 90 days out. I've done some searching but haven't found anything
>>usable yet.
>>Chris
>>
>>------------------------------------------------------------------------------
>>08/05/2003, 10:42:18 AM
>>This e-mail and any attachments represent the views and opinions of only
>>the sender and are not necessarily those of Memphis Light, Gas & Water
>>Division, and no such inference should be made.
>>==============================================================================
>
>--
>* * Please support the community that supports you. * *
>http://evolt.org/help_support_evolt/
>
>For unsubscribe and other options, including the Tip Harvester and
>archives of thelist go to: http://lists.evolt.org Workers of the Web, evolt !
More information about the thelist
mailing list