CSharp examples for System:DateTime Convert
Convert To ISO Standard Date Time
using System.Threading.Tasks; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*from ww w.j av a2s .co m*/ public class Main{ public static DateTime? ConvertToISOStandardDateTime(this DateTime? obj, string value) { DateTime date = new DateTime(); if (DateTime.TryParse(value, out date)) { return date.ToUniversalTime(); } return null; } public static DateTime ConvertToISOStandardDateTime(this DateTime obj, string value) { DateTime date = new DateTime(); if (DateTime.TryParse(value, out date)) { return date.ToUniversalTime(); } return DateTime.MinValue; } }