CSharp examples for System:DateTime Format
To Standard Date Time String
// Copyright (c) Microsoft Corporation. All rights reserved. using System;/* w w w . j a v a 2s . co m*/ public class Main{ public static string ToStandardDateTimeString(this DateTime dateTime) { return dateTime.Kind == DateTimeKind.Utc ? dateTime.ToString("yyyy-MM-ddTHH:mm:ssZ") : dateTime.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"); // ISO 8601 } }