Home > Software design >  C-Sharp DateTime Culture format for SQL Date-Format
C-Sharp DateTime Culture format for SQL Date-Format

Time:03-09

Is there a culture for this date-format?

2022-03-08 23:59:59

Or do I have to do this manualy with .ToString()?

CodePudding user response:

Does it matter if there is a culture which ensures that DateTime.ToString will output this format? What matters is if you want to output a DateTime in a culturally appropriate format or not. If you don't care about a (given) culture, why do you ask for it?

If all you need is a DateTime as a string in that format, use:

string dtAsString = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  • Related