Reputation: 2026
I am using
((DateTime)newsItem.Date).ToString(@"yyyy MM dd")
which gives me 2010 11 24 but not 2010-11-24.
I want dashes in between the numbers of date.
Upvotes: 12
Views: 17644
Reputation: 4084
https://web.archive.org/web/20211020131217/https://www.4guysfromrolla.com/articles/111010-1.aspx This will help you.
Upvotes: 0
Reputation: 60754
Have you tried
((DateTime)newsItem.Date).ToString(@"yyyy-MM-dd");
Also, since you format the time part away anyway in the ToString
, you don't need to add .Date
, and you can change it to
((DateTime)newsItem).ToString(@"yyyy-MM-dd");
Upvotes: 32