hi,
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);
Console.Write(t);
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.
parassaini 0 Newbie Poster
nick.crane 342 Veteran Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.