• Enter Slide 1 Title Here

    This is slide 1 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words.

  • Enter Slide 2 Title Here

    This is slide 2 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words.

  • Enter Slide 3 Title Here

    This is slide 3 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words.

February 13, 2017

Best Practice to Increment/Decrement Date in Javascript

I realized that the best way to increment or decrement date in javascript is by adding or reducing miliseconds of the date. Here is the example:


var today = new Date();
var tomorrow = new Date(today.getTime() + (24 * 60 * 60 * 1000));
var yesterday = new Date(today.getTime() - (24 * 60 * 60 * 1000)); 

The output will be like this

Today is
Tomorrow is
Yesterday is

Lets make a function for it.

function incrementOrDecrementDate(date, dayValue) {
    return new Date(date.getTime() + (dayValue * 864e5));
}

If you want to increment the date, pass positive value in dayValue. If you want to decrement the date, pass negative value in it. Let's try to get the date 10 days from today and 10 days before today.


var tenDaysFromNow = incrementorDecrementDate(new Date(), 10);

Here is the result


February 03, 2017

Microsoft Visual Studio 2015 Installation for Apache Cordova Development

It's true that you don't need specific IDE for Apache Cordova development. But using an IDE will let you do anything easier and give you more productivity. So far, Microsoft Visual Studio is currently the best IDE for hybrid app development using Apache Cordova. Especially for a novice like me.