Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
$('.EditUser').click(function () {
    
        var $row = this;
        var userCode = $(this).attr('id');
        tabelrowid = userCode
        delClass = $('.EditUser').attr('class');
        $('#hdnUserId').val(userCode);
        $.ajax({
            type: "POST",
            url: "User_Create_Update.aspx/FillUserDetails",
            data: '{strUserCode:"' + userCode + '"}',
            contentType: "application/json; charset=utf-8",
            success: function (msg) {
                if (msg.d != '') {
                    $('#txtUserCode').val(msg.d.USRM_USER_CD);
                    $('#txtUserName').val(msg.d.USRM_USER_NAME);
                    $('#txtUserPswd').val(msg.d.USRM_PASSWORD);
                    var cmbval = $('#MainContent_cmbProfileID').val(msg.d.USRM_Profile_ID);
                    $('#MainContent_cmbProfileID').attr('selectedvalue', cmbval);
                    $('#txtLoginAttempt').val(msg.d.USRM_Login_Attempt);
                    $('#MainContent_txtExpiryDate').val(msg.d.USRM_EXPIRY_DT);
                }
                        }
        });
Posted
Updated 7-Feb-13 1:41am
v2

1 solution

//Use below JavaScript Method to convert JSON date into normal date

C#
// Conversion into Normal Date String
function ChangeDateFormat(jsondate) {
    jsondate = jsondate.replace("/Date(", "").replace(")/", "");
    if (jsondate.indexOf("+") > 0) {
        jsondate = jsondate.substring(0, jsondate.indexOf("+"));
    }
    else if (jsondate.indexOf("-") > 0) {
        jsondate = jsondate.substring(0, jsondate.indexOf("-"));
    }

    var date = new Date(parseInt(jsondate, 10));
    var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
    var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    return currentDate + "/" + month + "/" + date.getFullYear();
}
 
Share this answer
 

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