Get Date
ASP.NET
2
Posts
2
Posters
0
Views
1
Watching
-
Does anyone know how to get the date to 2 characters ie 2006 would be 06. this has been baffling me for a while now. Any help is much appreciated
Use the
ToString()
method of the DateTime object with a pattern argument that includes "yy" for a two-character year... something like this:DateTime theDate = System.DateTime.Now;
String dateAsString = theDate.ToString("dd-MMM-yy");