You can make your field(I assume, is where this attribute is attached to)
into a property and use a ToString of the DateTime to output whatever you
want.
private DateTime _ABC;
[XmlAttributeAttribute(AttributeName="time")]
public string DateTimeAttributeNamedABC
{
get
{
return _ABC.ToString("T");
}
set
{
_ABC = DateTime.Parse(value);
}
}
Something like that. I'm not sure about the setter. You probably need
something better there.
"Daniel Lidström" <so*****@microsoft.com> wrote in message
news:1b******************************@40tude.net.. .
On Thu, 27 May 2004 12:53:48 +0200, Aleks wrote:
"Daniel Lidström" <so*****@microsoft.com> wrote in message
news:un****************************@40tude.net... How do I serialize a DateTime attribute to HH:MM:SS? I've tried this:
[XmlAttributeAttribute(AttributeName="time", DataType="time")]
But it is serialized as time="10:45:34.7031250+02:00". I would like it
to be plainly "10:45:34". I will not be doing any calculations on the
time, just record time of creation.
Hi,
maybe you should try to create a serializable Class where you will put a
reference of your DataTime object.
Thanks for the idea Aleks.
--
Daniel