公告
财富商城
积分规则
提问
发文
2019-09-30 06:18发布
该账号已被封号
How to format a DateTime as follows?
yyyy-mm-dd hh:mm:ss in 24 hr format
example
2001-03-16 14:45:00
yyyy-MM-dd HH:mm:ss
For example:
DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss")
You can use the HH format to get the hour in 24h, for sample:
HH
string dateFormated = dateTimeObj.ToString("yyyy-MM-dd HH:mm:ss");
also use MM to get the month in 2 chars. You can take a look at MSDN documentation.
MM
最多设置5个标签!
yyyy-MM-dd HH:mm:ss
For example:
DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss")
You can use the
HH
format to get the hour in 24h, for sample:also use
MM
to get the month in 2 chars. You can take a look at MSDN documentation.