How to remove mili seconds from '0' date formatting

56 views Asked by At

I am trying to convert the DateTime to following Format.

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

When I am trying with 'o' formatter getting the out put in following format,

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

output:2015-06-12T16:54:47.3206929+05:30

I need to remove the mil seconds from that .

Not getting any formatters from MSDN

Any other Formatters?

1

There are 1 answers

0
Bas On

You can use a custom formatter:

string plannedStartTime = startTime.ToString("yyyy-MM-ddTHH:mm:sszzz");

See also Custom Date and Time Format Strings