/// <include file='docs/MySqlDataReader.xml' path='docs/GetDateTime/*'/> public override DateTime GetDateTime(int i) { IMySqlValue val = GetFieldValue(i, true); MySqlDateTime dt; if (val is MySqlDateTime) { dt = (MySqlDateTime)val; } else { // we need to do this because functions like date_add return string string s = GetString(i); dt = MySqlDateTime.Parse(s); } if (connection.Settings.ConvertZeroDateTime && !dt.IsValidDateTime) { return(DateTime.MinValue); } else { return(dt.GetDateTime()); } }
public DateTime GetDateTime(int i, bool convertTimeZone) { IMySqlValue val = GetFieldValue(i, true); MySqlDateTime dt; if (val is MySqlDateTime) { dt = (MySqlDateTime)val; } else { // we need to do this because functions like date_add return string string s = GetString(i); dt = MySqlDateTime.Parse(s); } dt.TimezoneOffset = driver.timeZoneOffset; if (connection.Settings.ConvertZeroDateTime && !dt.IsValidDateTime) { return(DateTime.MinValue); } else { return(dt.GetDateTime(convertTimeZone)); } }
public override DateTime GetDateTime(int i) { MySqlDateTime time; IMySqlValue fieldValue = this.GetFieldValue(i, true); if (fieldValue is MySqlDateTime) { time = (MySqlDateTime)fieldValue; } else { time = MySqlDateTime.Parse(this.GetString(i), this.connection.driver.Version); } if (this.connection.Settings.ConvertZeroDateTime && !time.IsValidDateTime) { return(DateTime.MinValue); } return(time.GetDateTime()); }
public override DateTime GetDateTime(int i) { IMySqlValue fieldValue = this.GetFieldValue(i, true); MySqlDateTime mySqlDateTime; if (fieldValue is MySqlDateTime) { mySqlDateTime = (MySqlDateTime)fieldValue; } else { mySqlDateTime = MySqlDateTime.Parse(this.GetString(i)); } mySqlDateTime.TimezoneOffset = this.driver.timeZoneOffset; if (this.connection.Settings.ConvertZeroDateTime && !mySqlDateTime.IsValidDateTime) { return(DateTime.MinValue); } return(mySqlDateTime.GetDateTime()); }