CSharp examples for System:DateTime Format
Get ISO Standard Date Time
using System.Threading.Tasks; using System.Text; using System.Linq; using System.Collections.Generic; using System;//w ww .j ava2s . co m public class Main{ public static string GetISOStandardDateTime(this DateTime value) { return value.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); } public static string GetISOStandardDateTime(this DateTime? value) { if (value.HasValue) { return value.Value.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); } else { return string.Empty; } } }