Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Compare two dates
- From: ol.grossmann at bluewin.ch (OIivier Grossmann)
- Subject: [Javascript] Compare two dates
- Date: Fri Oct 14 10:19:55 2005
Hello Laurent,
thanks for your explanation.
I have implemented your code example into my source successfully.
Thanks.
Greet Olivier
>-- Original-Nachricht --
>From: "Laurent Muchacho" <elmuchacho@xxxxxxxxx>
>To: "[JavaScript List]" <javascript@xxxxxxxxxx>
>Subject: Re: [Javascript] Compare two dates
>Date: Fri, 14 Oct 2005 15:11:50 +0100
>Reply-To: "[JavaScript List]" <javascript@xxxxxxxxxx>
>
>
>Hi Olivier,
>
>Found below the code describing how to check 2 dates.
>The Variable "now" define the present time, the only thing you need to do
>is
>substract the date you wish to check and if the difference is a negative
>
>value then the date happen before.
>I hope this help sorry my explanation is not really clear but I guess this
>
>is what you are looking for.
>
>var now = new Date();
>var yesterday = new Date(2005,09,13,00,00,00);
>var tomorrow= new Date(2005,09,15,00,00,00);
>
>alert('now : ' + now + '\nyesterday : ' + yesterday + '\ntomorrow : '
+
>
>tomorrow);
>
>alert((yesterday - now)+ '\n' + (tomorrow - now))
>
>if((yesterday - now)<0){
>
> alert('date tested as before now');
>
>}
>
>
>Laurent
>
>----- Original Message -----
>From: "OIivier Grossmann" <ol.grossmann@xxxxxxxxxx>
>To: <javascript@xxxxxxxxxx>
>Sent: Friday, October 14, 2005 2:05 PM
>Subject: [Javascript] Compare two dates
>
>
>> Hello everybody,
>>
>> i would like to validate/compare two dates. The first date should be
>> earlier
>> than the second one.
>>
>> Have you an idea?
>>
>> Greet Olivier
>>
>> _______________________________________________
>> Javascript mailing list
>> Javascript@xxxxxxxxxx
>> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>_______________________________________________
>Javascript mailing list
>Javascript@xxxxxxxxxx
>https://lists.LaTech.edu/mailman/listinfo/javascript
- References:
- [Javascript] Compare two dates
- From: Laurent Muchacho
- [Javascript] Compare two dates
- Prev by Date: [Javascript] Setting the size/width of a select control.
- Next by Date: [Javascript] Compare two dates
- Previous by thread: [Javascript] Compare two dates
- Next by thread: [Javascript] Compare two dates
- Index(es):