public static NpgsqlDateTime Parse(string str) { if (str == null) { throw new NullReferenceException(); } switch (str = str.Trim().ToLowerInvariant()) { case "infinity": return(Infinity); case "-infinity": return(NegativeInfinity); default: try { var idxSpace = str.IndexOf(' '); var datePart = str.Substring(0, idxSpace); if (str.Contains("bc")) { datePart += " BC"; } var idxSecond = str.IndexOf(' ', idxSpace + 1); if (idxSecond == -1) { idxSecond = str.Length; } var timePart = str.Substring(idxSpace + 1, idxSecond - idxSpace - 1); return(new NpgsqlDateTime(NpgsqlDate.Parse(datePart), TimeSpan.Parse(timePart))); } catch (OverflowException) { throw; } catch { throw new FormatException(); } } }
public NpgsqlDateTime(NpgsqlDate date) : this(date, TimeSpan.Zero) { }
public NpgsqlDateTime(NpgsqlDate date, TimeSpan time, DateTimeKind kind = DateTimeKind.Unspecified) : this(KindToInternalType(kind), date, time) { }