Converts the supplied DateTimeOffset to a String in the specified format. : XML Convert « XML LINQ « C# / C Sharp






Converts the supplied DateTimeOffset to a String in the specified format.

 

using System;
using System.Xml;

class Example
{
    static void Main()
    {
        DateTimeOffset dto;
        dto = DateTimeOffset.Now;

        String timeAsString = XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:sszzzzzzz");
        Console.WriteLine(timeAsString);
    }
}

   
  








Related examples in the same category

1.Decodes a name. This method does the reverse of the EncodeName and EncodeLocalName methods.
2.Converts the supplied String to a DateTimeOffset equivalent.
3.Converts the DateTime to a String.
4.Converts the supplied DateTimeOffset to a String.
5.Verifies that the name is a valid name according to the W3C Extended Markup Language recommendation.
6.Verify Xml Chars