Display current time in this format: HH:mm:ss

Yustme picture Yustme · Aug 1, 2010 · Viewed 43.2k times · Source

I'm having some trouble displaying the time in this format: HH:mm:ss. No matter what i try, i never get it in that format.

I want the time in the culture of the Netherlands which is "nl-NL".

This was one of my (although i forgot to keep the count) 1000th try:

CultureInfo ci = new CultureInfo("nl-NL");

string s = DateTime.Now.TimeOfDay.ToString("HH:mm:ss", ci);

What am i doing wrong?

Answer

Darin Dimitrov picture Darin Dimitrov · Aug 1, 2010
string s = DateTime.Now.ToString("HH:mm:ss");