So I want a date formated like this 27/7. My code looks like this
<%# Eval("WStartDate", "{0:d/M}" ) %>
And the result is a date that looks like: 27-7.
How can I change this? I dont want to change my regional settings….
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.
The reason why you get
-instead of/is because the/character has a special meaning in a DateTime format: it represents the date separator in the current culture. If you want to display as literal you should escape it with single quotes:'.UPDATE:
According to your comment it seems that you are using this Eval statement inside an ASP.NET server side tag to set some property such as a label text for example. In this case you could define the format as a separate variable:
and then use it: