如何从' 0'删除mili秒日期格式

时间:2015-06-10 15:31:06

标签: c# .net datetime-format

我正在尝试将DateTime转换为以下格式。

2015-05-30T12:00:00 + 05:30

当我尝试使用' o'格式化程序以下列格式输出,

string plannedStartTime = startTime.ToString("o");
  

输出:2015-06-12T16:54:47.3206929 + 05:30

我需要从那里删除毫秒。

未从MSDN

获取任何格式化程序

任何其他格式化程序?

1 个答案:

答案 0 :(得分:5)

您可以使用自定义格式化程序:

myfunctionname()

另见Custom Date and Time Format Strings

相关问题