I'm trying to get the date into a string in C#. I want the format of:
2011.02.14
Which is, YYYY.MM.DD
Can someone please let me know the command for this? And also is there a way to do like Date(-1)?
Thanks.
For the first:
string s = DateTime.Now.ToString("yyyy.MM.dd");
For the second, you'd need to be explicit about what Date(-1)
should return, but I expect it involves var foo = someDate.Add(timespan);
or var foo = someDate.Add{SomeInterval}(delta);
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