0

I am trying to convert a row of data from our database values into a xml file. I am using the c# .net xmlTextWriter. Everything is fine but I cannot format the date time value for some reason.

Below is the code I have tried using a String.Format:

xmlWrt.WriteStartElement("", "Call", namespace);
xmlWrt.WriteElementString("Value", namespace, String.Format("{0:dd MMM yyyy HH:mm}", man.orderDateTime));   
xmlWrt.WriteEndElement();

In the database the value of the date and time is displayed as: 23 Jul 2015 13:05.

Need it to display as 23 Jul 2015 13:05 but it is displaying as Jul 23 2015 1:05PM in the xml that i am out puting for some reason.

Nic
  • 11
  • 2
user3636272
  • 71
  • 1
  • 10
  • I found the answer and it was a silly one! the datatype on the database is a varchar and it displayed the incorrect date in the database. – user3636272 Nov 12 '15 at 17:23

1 Answers1

0

I found the answer and it was a silly one! the datatype on the database is a varchar and it displayed the incorrect date in the database.

The syntax above is correct i believe

user3636272
  • 71
  • 1
  • 10