Help with DateTime in format I need
Posted
by baron
on Stack Overflow
See other posts from Stack Overflow
or by baron
Published on 2010-05-03T06:34:05Z
Indexed on
2010/05/03
6:38 UTC
Read the original article
Hit count: 238
I am working with DateTime, trying to get date in the format like this:
03.05.2010-04.05.23
that is: dd.MM.yyyy-HH.mm.ss
I'm using DateTime.ParseExact
to try to achieve this (maybe wrong)
So far I have:
var dateInFormat = DateTime.ParseExact(DateTime.Now.ToShortDateString(), "dd.MM.yyyy.HH.mm.ss", null);
But can't quite get exactly what I want. Basically I want to keep the 0, for example time is 05:03:20 PM I don't want it to show like 5:3:20 PM
Any ideas?
© Stack Overflow or respective owner