Jquery alter date format based on selector -


my hands tied bit using fullcalendar.js parse ical on site. want create different format altogether limited bit. question is, can use jquery re-format dates specific selector?

for example:

<tr class="fc-list-heading" data-date="2017-03-28"> <td class="fc-widget-header" colspan="3"> <span class="fc-list-heading-main">tuesday</span> <span class="fc-list-heading-alt">march 28, 2017</span> </td> </tr> 

could select .fc-list-heading-alt span classes , re-format date 28 march? i've looked on net havent found solution.

for(var = 0; < $(".fc-list-heading-alt").length; i++)  {        var elem =$(".fc-list-heading-alt").get(i);        var date = new date($(elem).text());            $(elem).text(date.todatestring());    }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <tr class="fc-list-heading" data-date="2017-03-28">  <td class="fc-widget-header" colspan="3">  <span class="fc-list-heading-main">tuesday</span>  <span class="fc-list-heading-alt">march 28, 2017</span>  </td>  </tr>

check out https://www.w3schools.com/jsref/jsref_obj_date.asp functions of date object.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -