Sample Javascript:
{!REQUIRESCRIPT(“/soap/ajax/20.0/connection.js”)}
{!REQUIRESCRIPT(“/soap/ajax/20.0/apex.js”)}
var date1Str = {!YEAR(Sample__c.Sample__c)} + ‘/’ + {!MONTH(Sample__c.Sample__c)} + ‘/’ + {!DAY(Sample__c.Sample__c)};
var date1 = new Date(date1Str);
var date2Str = {!YEAR(Sample__c.Sample__c)} + ‘/’ + {!MONTH(Sample__c.Sample__c)} + ‘/’ + {!DAY(Sample__c.Sample__c)};
var date2 = new Date(date2Str);
{!REQUIRESCRIPT(“/soap/ajax/20.0/connection.js”)}
{!REQUIRESCRIPT(“/soap/ajax/20.0/apex.js”)}
var date1Str = {!YEAR(Sample__c.Sample__c)} + ‘/’ + {!MONTH(Sample__c.Sample__c)} + ‘/’ + {!DAY(Sample__c.Sample__c)};
var date1 = new Date(date1Str);
var date2Str = {!YEAR(Sample__c.Sample__c)} + ‘/’ + {!MONTH(Sample__c.Sample__c)} + ‘/’ + {!DAY(Sample__c.Sample__c)};
var date2 = new Date(date2Str);
if( date2 < date1 ){
//Logic
}
Cheers!!!