所以我有这个DateTime?而我想要做的是获得小时,但以24小时格式显示.
例如:
如果小时是下午2:20:23,我想将其转换为14:20就是这样.
我正在使用Visual C#.请任何想法,谢谢.
我有类似的东西
public static string FormatearHoraA24(DateTime? fechaHora)
{
if (!fechaHora.HasValue)
return "";
string retornar = "";
//here goes what i need
}
Run Code Online (Sandbox Code Playgroud) 我想在没有"AM/PM"的情况下获得今天的日期时间
DateTime dt=DateTime.Now;
Run Code Online (Sandbox Code Playgroud)
给我
2016年3月23日上午03:16:51
我希望结果是:
2016/05/23 15:16:51