I wonder if there is a better way to get the last digit of a year from a datatime object
var date = DateTime.Now;
string year1 = date.ToString("y"); //NOT OK return Month year (eg March 2012)
char year2 = date.ToString("yy")[1]; //OK return last digit of the year (eg 2)
char year3 = date.ToString("yy").Last(); //OK same as above using linq
Anyone know if an already predifine format exist for retreiving the last digit of the year?
Thanks
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