This code was working yesterday but not now. I haven't changed anything... Why is that and how can i fix it?
{
var info = TimeZoneInfo.FindSystemTimeZoneById("Turkey Standard Time");
DateTimeOffset localServerTime = DateTimeOffset.Now;
DateTimeOffset istanbulTime = TimeZoneInfo.ConvertTime(localServerTime, info);
con.Open();
cmd.CommandText = "UPDATE BilgisayarDuyuru SET date='" + istanbulTime + "' WHERE id='" + id + "'";
cmd.ExecuteNonQuery();
con.Close();
}
Ok try this
{
var info = TimeZoneInfo.FindSystemTimeZoneById("Turkey Standard Time");
DateTimeOffset localServerTime = DateTimeOffset.Now;
DateTimeOffset istanbulTime = TimeZoneInfo.ConvertTime(localServerTime, info);
string s1 = istanbulTime.ToString("yyyy-MM-dd HH:mm:ss.ffffff zzz");
con.Open();
cmd.CommandText = "UPDATE BilgisayarDuyuru SET date='" + s1+ "' WHERE id='" + id + "'";
cmd.ExecuteNonQuery();
con.Close();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With