Hi nauna,
Read the xml string and convert the date value to the required format.
Refer below example.
Namespaces
C#
using System.Globalization;
using System.Xml;
VB.Net
Imports System.Globalization
Imports System.Xml
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
string xml = "<note><Name>Jan</Name><Created_date>20-01-2021 16:25:12</Created_date></note>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
string xpath = "note/Created_date";
var nodes = doc.SelectNodes(xpath);
foreach (XmlNode node in nodes)
{
node.InnerText = DateTime.ParseExact(node.InnerText, "dd-MM-yyyy HH:mm:ss", CultureInfo.InvariantCulture).ToString("dd-MMM-yyyy");
}
ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('" + doc.OuterXml + "')", true);
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim xml As String = "<note><Name>Jan</Name><Created_date>20-01-2021 16:25:12</Created_date></note>"
Dim doc As XmlDocument = New XmlDocument()
doc.LoadXml(xml)
Dim xpath As String = "note/Created_date"
Dim nodes = doc.SelectNodes(xpath)
For Each node As XmlNode In nodes
node.InnerText = DateTime.ParseExact(node.InnerText, "dd-MM-yyyy HH:mm:ss", CultureInfo.InvariantCulture).ToString("dd-MMM-yyyy")
Next
ClientScript.RegisterClientScriptBlock(Me.GetType(), "", "alert('" & doc.OuterXml & "')", True)
End Sub
Screenshot