I try to convert something like this: "Wednesday, 21. January 2024" into this: "03.01.2024". How can I do this in c#?
I will use it for a program. There is an DateTimePickerand I will convert the output into a String.
Edit: The original input is in German...
thanks Laurin
Please, note that
21 Januaryis Sunday, not Wednesday, let's change21to3and perform a standard trick: parsetextintoDateTimeand then format it into desired string representation:If original text is in German (Deutsch culture, say
de-DE) it should beand we have
Finally, you can try using current culture (German on your workstation)