I made 2 radio buttons so that the user can choose whether he wants to watch the time in 24h format or in 12h format, this is the code that I have on the timer:
var format = rad24h.Checked ? "HH:mm" : "hh:mm:ss tt";
timer1.Interval = 500;
DateTime myDateTime = DateTime.Now;
label1.Text = string.Format("Hora actual {0}\n ", myDateTime.ToString(format));
lblHK.Text = string.Format("Hong Kong {0}\n ", myDateTime.AddHours(7).ToString(format));
lblNY.Text = string.Format("Nova Iorque {0}\n ", myDateTime.AddHours(-5).ToString(format));
lblUkr.Text = string.Format("Ucrânia {0}\n", myDateTime.AddHours(2).ToString(format));
lblTay.Text = string.Format("Taymyrskiy {0}\n ", myDateTime.AddHours(3).ToString(format));
lblAla.Text = string.Format(" Alaska {0}\n", myDateTime.AddHours(-9).ToLongString(format));
lblUru.Text = string.Format("Uruguay {0}\n", myDateTime.AddHours(-4).ToString(format));
lblSyd.Text = string.Format(" Sydney {0}\n", myDateTime.AddHours(9).ToString(format));
lblMad.Text = string.Format("Madagascar {0}\n ", myDateTime.AddHours(2).ToString(format));
The only label that works with this is lblUkr, (fourth from top to bottom) ...
I checked everything on the other lines to make sure they are the same, what am I missing?
Also, the label does not show AM / PM ... how can I do this?
UPDATE
, - ... , , lblUkr, , , 24h , , , ... , - , , , ... , ?
2
, , , , AM, PM , ?