Ändern Sie das Format eines Datums in TT/MM/JJJJJquery

JQuery-Programmierung
Guest
 Ändern Sie das Format eines Datums in TT/MM/JJJJ

Post by Guest »

Weiß jemand, wie man den aktuellen JS-Code anpasst und dafür sorgt, dass [ItemDate] das Datum im TT/MM/JJJJ-Format anstelle des Standardformats MM/TT/JJJJ HH:mm:ss anzeigt

Der Code wird von einer Website kopiert, die XML in ein lesbares HTML-Format konvertiert ... Das Problem ist nur das Datumsformat, bei dem ich Schwierigkeiten habe, die Änderung umzusetzen.

Code: Select all

    

SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
Templates: {
Fields: {
'ItemsOverview': {
'View': repeatingSectionViewTemplate
}
}
}
});

function repeatingSectionViewTemplate(ctx) {
var xml = ctx.CurrentItem["ItemsOverview"];
var decodedxml = xml.DecodeXMLNotation();
var htm = "";

xmlDoc = $.parseXML( decodedxml );
$xml = $( xmlDoc );
$xml.find("Item").each(function() {
htm = htm + "" + $(this).find("ItemNumber").text() + "" + $(this).find("ItemDescription").text() + "" + $(this).find("ItemStatus").text() + "" + $(this).find("ItemDate").text()
+"" + $(this).find("CollectedByUser").text() +"";
});

return "ItemDescriptionStatusDateCollected By" + htm +"";
};

//Replaces html notation to their equivalent xml escape characters.
String.prototype.DecodeXMLNotation = function () {
var output = this;
if ($.trim(output) != "") {
output = output.replace(/&apos;/g, "'").replace(/"/g, '"').replace(/>/g, '>').replace(/</g, '

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post