KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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
Tags (comma-separated)
Save Edits
Cancel