Beginnerprogrammer Beginnerprogrammer - 6 months ago 9
Javascript Question

How to stop code from running on a specific date

I want to stop a specific part of my code from running when its 29th of may. Someone can help me out on this with

jQuery
or
JavaScript
.

Answer

You can try something like this,

var CurrentDate = new Date();
var YourSelectedDate = new Date(2016, 04, 29, 10, 15); //Here it is 29th may 2016

    if(CurrentDate > YourSelectedDate ){
        //CurrentDate is more than YourSelectedDate 
       // Display warning message or whatever you want to display.
    }
    else{
        //YourSelectedDate is more than CurrentDate
        //put your code in this part.
    }