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.
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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With