CSharp examples for System:DateTime UTC
Default DateTime To Utc
using System;//from w ww . ja v a 2 s .c o m public class Main{ public static DateTime? DefaultToUtc(DateTime? date) { return date.HasValue && date.Value.Kind == DateTimeKind.Unspecified ? DateTime.SpecifyKind(date.Value, DateTimeKind.Utc) : date; } public static DateTime DefaultToUtc(DateTime date) { return date.Kind == DateTimeKind.Unspecified ? DateTime.SpecifyKind(date, DateTimeKind.Utc) : date; } }