In some project i need to display the current time as shown in taskbar. I have tried the code below
CultureInfo p = CultureInfo.CurrentCulture;
DateTime dt = DateTime.Now;
string t = dt.ToString("T", p);
My current time is 3:32 (According to my system's taskbar) and this code displays as 3:32:45. it should show exactly 3:32
My current regional setting is (English United States). I have customized the time format to H:mm:ss by clicking customise button in regional settings from control panel.
If i change the customized setting then this change is reflected in task bar and this must reflect in the code above, Now i customize the setting to hh:mm:ss tt, task bar displays 03:40 AM and code shows 03:40:28 AM. seconds should not be displayed.