How to output XML without the "-05:00" UTC offset?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-size:small <span style="font-family:Calibri Hi forum-ites,
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-family:Calibri; font-size:small
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-size:small <span style="font-family:Calibri We have a VB.Net 2008 console app whose Module1.vb does a few queries from our SQL Server database and outputs them as XML to be sent to
our customer.
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-family:Calibri; font-size:small
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-size:small <span style="font-family:Calibri The problem is that DateTime elements that contain only times (e.g., 1900-01-01 21:26:03.000) are being output to the XML with a UTC (Universal
Time) offset of â-06:00â appended, e.g., <START_TIME>13:56:55.0000000-06:00</START_TIME>
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-family:Calibri; font-size:small
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-size:small <span style="font-family:Calibri This gets converted to an hour later when accessed by our customer in the Eastern time zone, so they requested Time values like 13:56:55.0000000,
without the -06.00.
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-family:Calibri; font-size:small
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-family:Calibri; font-size:small Does anyone know how to do this?
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-family:Calibri; font-size:small
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-size:small <span style="font-family:Calibri Details:
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-family:Calibri; font-size:small
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-size:small <span style="font-family:Calibri The VS solution has a web reference Iâll call WS.
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-size:small <span style="font-family:Calibri Module1.vb queries the DB, letâs say the tblStats table, and reads thru the data in a DataReader.<span style="
For each row, it does:
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-family:Calibri; font-size:small
<p style="margin:0in 0in 0pt 0.5in <span style="font-family:"Lucida Console"; color:blue; font-size:9pt Dim<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt MyWS
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt As<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt New<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt WS.tblSTATS_TYPE_V1 which is a complexType in the wsdl
<p style="margin:0in 0in 0pt 0.5in <span style="font-family:"Lucida Console"; color:#000064; font-size:9pt MyWS.Start_Time = CheckTime(MyDataReader(<span style="font-family:"Lucida Console"; color:#840000; font-size:9pt "START_TIME"<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt ))
<p style="margin:0in 0in 0pt <span style="font-family:"Lucida Console"; color:#000064; font-size:9pt
<p style="margin:0in 0in 0pt <span style="font-family:"Lucida Console"; color:#000064; font-size:9pt ...where CheckTime is:<span style="color:#132f51
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-family:Calibri; font-size:small
<p style="margin:0in 0in 0pt <span style="font-family:"Lucida Console"; color:#000064; font-size:9pt <span style="
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt Private<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt Function<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt CheckTime(<span style="font-family:"Lucida Console"; color:blue; font-size:9pt ByVal<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt
Value <span style="font-family:"Lucida Console"; color:blue; font-size:9pt As<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt Object<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt )
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt As<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt DateTime
<p style="margin:0in 0in 0pt <span style="font-family:"Lucida Console"; color:#000064; font-size:9pt <span style="
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt If<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt (IsNothing(Value) =
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt True<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt )
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt Then<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt Return<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt New<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt DateTime(<span style="font-family:"Lucida Console"; color:#8000ff; font-size:9pt 0<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt )
<p style="margin:0in 0in 0pt <span style="font-family:"Lucida Console"; color:#000064; font-size:9pt <span style="
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt If<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt (IsDBNull(Value) =
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt True<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt )
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt Then<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt Return<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt New<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt DateTime(<span style="font-family:"Lucida Console"; color:#8000ff; font-size:9pt 0<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt )
<p style="margin:0in 0in 0pt <span style="font-family:"Lucida Console"; color:#000064; font-size:9pt <span style="
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt If<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt (IsDate(Value) =
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt False<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt )
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt Then<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt Return<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt New<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt DateTime(<span style="font-family:"Lucida Console"; color:#8000ff; font-size:9pt 0<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt )
<p style="margin:0in 0in 0pt <span style="font-family:"Lucida Console"; color:#000064; font-size:9pt <span style="
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt Return<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt New<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt DateTime(<span style="font-family:"Lucida Console"; color:blue; font-size:9pt CDate<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt (Value).TimeOfDay.Ticks,
DateTimeKind.Unspecified)<span style="font-family:"Lucida Console"; background:blue; color:green; font-size:9pt
<p style="margin:0in 0in 0pt <span style="font-family:"Lucida Console"; color:#000064; font-size:9pt <span style="
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt End<span style="font-family:"Lucida Console"; color:#000064; font-size:9pt
<span style="font-family:"Lucida Console"; color:blue; font-size:9pt Function<span style="color:#132f51
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-family:Calibri; font-size:small
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-size:small <span style="font-family:Calibri â but my addition of the DateTimeKind.Unspecified had no effect.
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-size:small <span style="font-family:Calibri
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-size:small <span style="font-family:Calibri Id appreciate any pointers... thanks!
<p style="margin:0in 0in 0pt <span style="color:#132f51 <span style="font-size:small <span style="font-family:Calibri

View the full article
 
Back
Top