0

I have one array which contain date.
now i want to convert this value into specify format.
because i receive error conversion of a varchar data type to a datetime data type resulted in an out-of-range value c#
here is code


                checkedvalue = [];
                $("input[name=chkRoles]").each(function () {

                    if ($(this).is(":checked")) {

                        checkedvalue.push($(this).val());
                        //alert($(this).val());
                    }

                });

theCheckedValue array contain date in format

2020-02-12,2020-02-13

i want data in format something like this.

format("DD-MM-YYYY HH:MM")

Here is my loop code

jQuery.each(checkedvalue, function (i, val) {
alert(val);
});

In loop i want to convert the format from 2020-02-12 to 2020-02-12 00:00:00.000

  • 2
    Does this answer your question? [Convert yyyy-mm-dd to UTC in Javascript](https://stackoverflow.com/questions/6273318/convert-yyyy-mm-dd-to-utc-in-javascript) – Umair Khan Feb 06 '20 at 13:03
  • ` var userDate = val; var date_string = moment(userDate, "YYYY-MM-DD").format("DD-MM-YYYY HH:MM"); alert(date_string);` Done – Programming And Design Feb 06 '20 at 17:12

0 Answers0