On 12 Jan 2007 02:52:05 -0800, "Gary" <ga********@myway.comwrote:
>f.CreationTime.Hour.ToString() + ":" +
f.CreationTime.Minute.ToString() + ":"
+ f.CreationTime.Millisecond.ToString();
Which produces a format like 9:30:124
Now I'd like to change this slightly. Firstly I do not need to know the
creation time of the file accurate to the thousandths of miliseconds!
So would prefer to have something like:
9:30:12
Secondly I'd like to append am/pm to the time, to give something like:
-
9:30:12 am
Can someone tell me how to modify the above original code to produce an
output more like the example directly above?
Thanks,
Gary.
Formatting can be done like this:
I don't think you can resolve to one thousandth of a millisecond, but you can
resolve to milliseconds, although I don't think you will actually get the exact
milliseconds.
string.Format("{0:H:mm:ss:ffff tt}", DateTime.Now)
I don't see that you used the seconds, which kind of makes the milliseconds
value meaningless. I added that one for you.
Look at string format in the documentation. You will find a kazillion ways to
format a DateTime object.
Good luck with your project,
Otis Mukinfus
http://www.arltex.com http://www.tomchilders.com