I have this:
var dateString = string.Format("{0:dd/MM/yyyy}", date);
But dateString is 13.05.2011 instead of 13/05/2011. Can you help me?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could use
DateTime.ToStringwithCultureInfo.InvariantCultureinstead:The reason why
/is replaced with.is that/is a custom format specifierSo either use
InvariantCulturewhich uses/as date separator or – more appropriate – escape this format specifier by embedding it within':Why this is more appropriate? Because you can still apply the local culture, f.e. if you want to output the month names, but you force
/as date separator anyway.