DateTime dt = DateTime.Now;
string format = "ddmmyy";
string postfix = dt.ToString(format);
Output : 110920
Console.WriteLine(postfix);
string format = "dd-mm-yy";
Output : 09-11-20
string format = "DDD mm yy";
Output : Wed 09 20
Format string pattern
M display one-digit month number
d display one-digit day of the month
h display one-digit hour on 12-hour scale
mm display two-digit minutes
yy display two-digit year
No comments:
Post a Comment