Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > xml, DateTime conversions and DateTime fields

Reply
Thread Tools

xml, DateTime conversions and DateTime fields

 
 
Andy B
Guest
Posts: n/a
 
      09-25-2008
I have a few questions about xml, DateTime conversions and DateTime fields.

1. in the example of DateTime.Now, how would you save it in the format
yyyy-mm-ddThh:mm:ssZ for xml storage?
2. If I have an xml attribute date="2008-09-25T13:15:00Z", How would I load
that into a DateTime variable?
3. Where can I get a list of valid time zone codes for use in xml storage?

Thanks for your help and answers.
P.S. My codebehind is VB.net in vs2008 sp1.


 
Reply With Quote
 
 
 
 
rrutkowski@gmail.com
Guest
Posts: n/a
 
      09-25-2008
On 25 Wrz, 12:05, "Andy B" <a_bo...@sbcglobal.net> wrote:
> I have a few questions about xml, DateTime conversions and DateTime fields.
>
> 1. in the example of DateTime.Now, how would you save it in the format
> yyyy-mm-ddThh:mm:ssZ for xml storage?
> 2. If I have an xml attribute date="2008-09-25T13:15:00Z", How would I load
> that into a DateTime variable?


I would simply use the ToString and ToDateTime methods of the
XmlConvert class.

--
Rudy
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      09-25-2008
Andy B wrote:

> 2. If I have an xml attribute date="2008-09-25T13:15:00Z", How would I load
> that into a DateTime variable?


> P.S. My codebehind is VB.net in vs2008 sp1.


You could use LINQ to XML then where you can simply cast the XAttribute
to a DateTime e.g.

Dim bar As XElement = <bar dt="2008-09-25T13:15:00Z"/>
Dim dt As DateTime = CType(bar.Attribute("dt"), DateTime)
Console.WriteLine(dt)

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[2.4.4] creating a datetime.datetime from an XML xs:dateTime Martin Python 0 12-27-2008 08:08 PM
mx.DateTime to datetime.datetime mp Python 1 07-28-2006 10:57 PM
Pointer conversions and Data types conversions vb@gmail.com C Programming 10 08-05-2005 09:51 AM
datetime: .datetime-.datetime = .timedelta, .time-.time=TypeError ? Christos TZOTZIOY Georgiou Python 3 09-13-2003 10:44 AM
RE: datetime: .datetime-.datetime = .timedelta, .time-.time=TypeError ? Tim Peters Python 0 09-09-2003 12:57 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57