having problem in converting datetime as required format like bellow
string a = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:sszzz", DateTimeFormatInfo.InvariantInfo);
I can get output like :2016-03-06T14:23:00.000+08:
but when I assign to that sting a to some date time value like below
DateTime dateform= convert.todatetime(a);
I got the output like :03/23/2016 12:00 P.M
for dateform object in C# code
actually I have a java service that service expecting "2016-03-06T14:23:00.000+08:" type of datetime but i am unble to send the format from C# code
service.aptdate=dateform;//here service.aptdate is datetime type so need to pass as it datetime only
when I see the java code they use like
XMLGregorianCalendar x=null;
GregorianCalendar c = new GregorianCalendar();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
c.setTime(new Date());
xCalUploadedDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
after he get the required format like "2016-03-06T14:23:00.000+08" but in C# I can't get. Any help how I convert.