On Wed, 28 Mar 2007 16:57:38 -0700, Jen <no**@nowhere.comwrote:
So I have the need to take UtcNow and change the Second to zero. Just
wondering how many ways there are to do that?
I would not be so bold as to put an upper bound on the number of ways to
do what you ask.
However, a couple of simple ways you might want to consider include:
* Use the DateTime.AddSeconds() method to add the negative of the
seconds property to the instance, which will set the seconds to zero
* Use one of the many constructors that exist for the DateTime
structure that include the seconds, copying all of the fields from an
initialized copy of DateTime.UtcNow except for the seconds field, which
you'll set to 0.
I don't doubt that there are many other alternatives, most of which are
probably a lot more complicated than the above. :)
Pete