Javascript return date from yyyy / mm / dd to dd / mm / yyyy

I am doing an asp project and the date is displayed as yyyy / mm / dd, but when the user clicks the edit button for the form, I need to replace the date format with dd / mm / yyyy

this asp code remembers, I need the user to show the date as yyyy / mm / dd in the table, but when he clicks on the button, I need the date that needs to be changed to dd / mm / yyyy

 <td class="hidden-phone">@EnnotaBAL.ArabicEncoding.GetArabicNumbers(transaction.PostDate.ToString("yyyy/MM/dd"))</td>

and this javascript code for the date element:

// Transaction Date
var TransDate = oCells.item(4).innerHTML;
document.getElementById('Date').value = convertDigitIn(TransDate);
+4
source share
1 answer
function convertDigitIn(str){
   return str.split('/').reverse().join('/');
}
+16
source

Source: https://habr.com/ru/post/1536644/


All Articles