How to add Number of Days to Date in Javascript.

Java Script Code snippet :-


$(function(){
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();

if(dd<10) {
dd='0'+dd
}

if(mm<10) {
mm='0'+mm
}

todayDate = mm+'/'+dd+'/'+yyyy;
var NewDate=AddDays(todayDate,10); //Calling method
document.write(NewDate);
});

function AddDays(jsDate,iNoOfDays){
var thisUTC = jsDate.getTimezoneOffset();
jsDate.setTime(jsDate.getTime() + iNoOfDays * 86400000);
if (thisUTC != jsDate.getTimezoneOffset()) {
jsDate.setTime(jsDate.getTime() + (jsDate.getTimezoneOffset() - thisUTC) * 60000);
}

return (jsDate);
}

Advertisements

Connect() Event Big Announcements.

Hii all .Net Techies;

Microsoft has declared lots of new announcement at Connect event 2016.

Believe me when i listen these announcement i surprised!!!!

Read bellow hope you too !!!

TEN Big Announcement by Microsoft :-

Via:Mr.Scott

scott

  1.  They released VS 2017 which is in RC . Which runs in any Operating system.
    Download VS2017

    vs2017
    Read More about VS2017
    New Features in VS2017 :-
    More enhancement in Intelisense support.

    new-intelisense-supoprt

  2. Microsoft fortifies commitment to open source and Join Linux Foundation as platinum member.
    Sql-Server17 running on Linux machine.

    really that’s Unbelievable

    sqllinux

  3.  Sql-Server 2017 release .

    sql-what-provide

  4. Sql-Server is the worlds fastest and reliable database.
    Stack Over flow using Sql-Server Database.

    stack

    Over-View of Sql-Server:

    sql2016

  5. Google Join at Net core foundation.
  6. Samsung Developer now converting to .Net Developer.
    Samsung Operating system Tizen runs now .Net core.
  7. Visual studio code IDE redefined and having more enhancement features.
    Running on Mac Machine :-
    #Awesome
    mac
  8. XAMARIN in New Look with multiple support for Development with new features.
  9. Higher performance then ever .Net core.
    techempower
  10. Azure container service.
    Whole .Net Echo System
    eco

Above picture show where is going .Net Now !!!

Amazing!!!
So be more energetic to do some thing more!!!! 🙂
Hope You also more excited to play with all these stuffs.

How do you feel about this post ??
Share your view.

Share it if you Like It.
Happy Coading.

🙂

Difference between ‘@’ and ‘@{}’

Do you know friends their is a difference between writing @{ Html.AntiforgeryToken();} and @Html.AntiforgeryToken.

The difference is :-

When we writing @Html.AntiforgeryToken() it means it will write the output of that method inside the page. So remember always when we writing @ symbol before any method at that time the ‘@’ behaves differently that it will call response.write() method internally and print the the output inside the page.
Where as @{//Inside any method} in that also we call the method same way but the difference is that it will not do any thing with output.

So here if we write @Html.AntiforgeryToken like this then it will create a hidden field inside the page with the name of Antiforgery token.

But if we do @{ Html.AntiforgeryToken();} then it will not print any thing inside the page.

Note :‘@’ means Response.write Encoded internally.

Example :- If you try the above method i.e Html.AntiforgeryToken().
Then writing this way @{Html.AntiforgeryToken();} gives you run time exception; because inside your page it won’t create any hidden field for AntiforgeryToken.
But when we write @Html.AntiforgeryToken(); then it work fine.

Key Capsule :- If any where if you see inside @{} block we are again writing @ symbol and calling the method then it mean that we want to print some html content.

For eg:-

@{
FWebControls.FOption ctrlMarginAccount = new FWebControls.FOption();
ctrlMarginAccount.Reset();
ctrlMarginAccount.CreateControl(sId: "optMarginAccount", sValue: "", sURL: MyHelper.GetOptionControlURL(), sWidth: "", sClassName: "Ftxtbox", iMasterTypeId: 1, bMandatory: true, bExactMatch: true);
@ctrlMarginAccount.GetHtml(); //This line if you see carefully i used @ symbol which mean that i want to print some thing inside the page.
}

 

Explanation :- If i write “ctrlMarginAccount.GetHtml()” then also the method called but it won’t print any thing inside the page. But when we add the ‘@’ before it then it called internally response.write method and print all the html content inside the page.

So all above Key thing to remember that calling @ means it will print any thing inside the page.

Thanks.

Reply your Feedback.

#Share#Like#Comment