c# datetime format
问题 I wish to have a specific format for my DateTime depending on the current culture. So I try this: dateTime.ToString("dd/MM/yyyy hh:mm"); This is partially OK, the / gets replaced by the culture-specific separator. But the day and month order are not switched (like MM/dd) depending on the culture. Using .ToString("g") works, but that doesn't include the leading zero. How do I accomplish this? 回答1: I think this will do what you want: System.Globalization.DateTimeFormatInfo format = System