Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public static void Main(string[] args)
  {

      DateTime ToDayDate = DateTime.Now.Date;

      DateTime RepayDate = DateTime.Parse(Console.ReadLine());

      DateTime LoanExpiryDate = ToDayDate.AddDays(30);

      if (RepayDate > LoanExpiryDate || RepayDate < ToDayDate)
      {
          Console.WriteLine("The number of days is more than 30Days ");
          Console.ReadKey();
      }
      else
      {
          Console.WriteLine("its Ok ");
          Console.ReadKey();
      }
  }


What I have tried:

Please i'm new to writing JQuery, I could easily archive this writing c# codes but could not archive the same on an event in JQuery.

Please kindly help with the reserve in JQuery. Thanks alot

Below is what i was doing
var d = new Date();
var month = d.getMonth() + 1;
var day = d.getDate();

var o = { year: 'numeric', month: '2-digit', day: '2-digit'};
var ToDayDate = d.toLocaleDateString('en-US', o);
console.log("value: " + ToDayDate)
Posted
Updated 13-Feb-19 2:34am

1 solution

To add days to your date, you're just using JavaScript rather than doing anything jQuery specific. It's a simple case of doing
JavaScript
const newDate = d.setDate(d.getDate() + numberOfDays);
 
Share this answer
 
Comments
wizklaus 13-Feb-19 9:25am    
// Thanks @Pete O'Hanlon I have done that

$(function () {
$("#txtDateJoinEmployer").datepicker({ dateFormat: "yy-mm-dd" });
$("#txtDateJoinEmployer").on("change", function () {
var RepayDate = $(this).val();
console.log("RepayDate " + RepayDate); // RepayDate 13/02/2019

var d = new Date();
var d1 = d;

var LoanExpiryDate = d1.setDate(d1.getDate() + 30);

console.log("LoanExpiryDate: " + LoanExpiryDate) // LoanExpiryDate: Fri Mar 15 2019 15:18:05 GMT+0100 (West Africa Standard Time)
if (RepayDate > LoanExpiryDate)
{
// How do i check for the conditions if RepayDate is greater than LoanExpiryDate
}
});

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900