0

In the jQuery datepicker, I select a date(e.g. 04/05/2015) and click submit.
When I reload the form with getting the values from server, it shows a date ahead by one day (05/05/2015). I want to get the same date back from server which I selected using datepicker.

I searched a little and found jquery uses client side date.
How to make it use server side date?

This is just a fragment of code.

function loadProductDataFromBrowser(currentStoreName) {
    $("#datepickerExpiresOn").datepicker({ appendText: "(yyyymmdd)", altFormat: "yymmdd", dateFormat: "yymmdd" });
}

function loadProductFromServerData(data, currentStoreName){
    document.getElementById('datepickerExpiresOn').value = data.expiresOn;
    $("#datepickerExpiresOn").datepicker({ appendText: "(yyyymmdd)", altFormat: "yymmdd", dateFormat: "yymmdd" });
}
Pragya Sharma
  • 94
  • 1
  • 2
  • 9
  • 1
    Check this out. May be you are facing the same problem http://stackoverflow.com/questions/9509360/datepicker-date-off-by-one-day – captainsac May 04 '15 at 11:55
  • No, I saw this answer but it didn't help. – Pragya Sharma May 04 '15 at 11:59
  • @PragyaSharma, This site doesn't work like u think! I didn't downvoted ur Q, just edited it to make more readable! – Vikrant May 04 '15 at 12:04
  • For me it seems like server-side problem. Can you make sure the date is properly getting stored and also check the date returned from the server – Praveen May 04 '15 at 12:15
  • I dont have access to the server. When I alert the value returned from server, it gives the date one day ahead. – Pragya Sharma May 04 '15 at 12:23

0 Answers0