You're welcome Param,
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
<#
[email protected]>
<
[email protected]>
<
[email protected]>
| Subject: Re: datetime format in xml
| Date: Mon, 14 Nov 2005 22:20:35 -0600
| Lines: 214
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| Message-ID: <
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
| NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:30884
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
|
| It worked. Thanks!
|
| | > Hi Param,
| >
| > Does my further reply helps a little? If there're still anything else we
| > can help, please feel free to post here.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure!
www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | X-Tomcat-ID: 130864800
| > | References: <
[email protected]>
| > <
[email protected]>
| > <#
[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain
| > | Content-Transfer-Encoding: 7bit
| > | From: (e-mail address removed) (Steven Cheng[MSFT])
| > | Organization: Microsoft
| > | Date: Thu, 10 Nov 2005 05:56:31 GMT
| > | Subject: Re: datetime format in xml
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
| > | Message-ID: <
[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
| > | Lines: 133
| > | Path: TK2MSFTNGXA02.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webservices:30835
| > | NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
| > |
| > | Thanks for your respone Param,
| > |
| > | As for .NET 2.0, of course the DateTime type has greatly enchanged.
The
| > | .NET 2.0 DateTime class support a DateTimeKind property which help
| > specify
| > | whether the datetime object is representing a local time, UTC time or
| > | unspecified....
| > |
| > | So for local and utc time, the default xmlserliazation output will
like
| > | below:
| > |
| > |
| > | local now:
| > |
| > | <dateTime>2005-11-10T13:50:52.5979344-08:00</dateTime>
| > |
| > | utc now:
| > |
| > | <dateTime>2005-11-10T21:50:52.5979344Z</dateTime>
| > |
| > |
| > | so we can see for UTC time it no longer append the unused TimeZone
| > offset.
| > | However, since the milliseconds is necessary for precise purpose, it
is
| > | still appended. So for you scenario, we should use the DateTime
| > Formatting
| > | flag to manually do the formatting so as to get the output we want.
| > |
| > | Thanks,
| > |
| > | Steven Cheng
| > | Microsoft Online Support
| > |
| > | Get Secure!
www.microsoft.com/security
| > | (This posting is provided "AS IS", with no warranties, and confers no
| > | rights.)
| > |
| > | --------------------
| > | | From: <
[email protected]>
| > | | References: <
[email protected]>
| > | <
[email protected]>
| > | | Subject: Re: datetime format in xml
| > | | Date: Wed, 9 Nov 2005 08:51:51 -0600
| > | | Lines: 92
| > | | X-Priority: 3
| > | | X-MSMail-Priority: Normal
| > | | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| > | | X-RFC2646: Format=Flowed; Original
| > | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| > | | Message-ID: <#
[email protected]>
| > | | Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
| > | | NNTP-Posting-Host: corp2.lazardgroup.com 70.182.148.88
| > | | Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| > | | Xref: TK2MSFTNGXA02.phx.gbl
| > | microsoft.public.dotnet.framework.aspnet.webservices:30825
| > | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
| > | |
| > | | Does this behavior change in Net 2.0? If so, how?
| > | |
| > | |
| > | | | > | | > Hi Param,
| > | | >
| > | | > Welcome to MSDN newsgroup.
| > | | > From your description, you're cosuming a certain webservice which
| > will
| > | | > pass
| > | | > DateTime object in your .NET client app. And you found that the
| > default
| > | | > serlized datetime output is not quite suit the webservice's actual
| > | | > requirement, yes?
| > | | >
| > | | > As for this quesiton, I think it is due to the current .net
| > framework
| > | | > (1.0,
| > | | > 1.1)'s DateTime class's limitation. The current DateTime class is
| > always
| > | | > persisted as local time format (with TimeZone offset...), also the
| > | | >
| > | | > 2005-11-07T18:34:36.6990563-06:00
| > | | >
| > | | > output you got is the default xml serlization output. Since we
can
| > not
| > | | > control the underlying xmlserlization of the DateTime class(
| > build-in
| > | | > basic
| > | | > type), I'd suggest you consider modifying the .NET client proxy
| > code,
| > | | > change that class property which uesd to be DateTime type to a
| > string
| > | | > type.
| > | | > Then, we can use the DateTime class's ToString method to perform
| > | datetime
| > | | > formatting which can output many different formats we want, here
is
| > the
| > | | > related msdn reference on DateTime formatting:
| > | | >
| > | | > #Standard DateTime Format Strings Output Examples
| > | | >
| > |
| >
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconstandarddatetimefo
| > | | > rmatstringsoutputexample.asp?frame=true
| > | | >
| > | | > Also, another msdn article discussing on the best practice using
| > | DateTime
| > | | > in .net 1.x application:
| > | | >
| > | | > #Coding Best Practices Using DateTime in the .NET Framework
| > | | >
| > |
| >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/ht
| > | | > ml/datetimecode.asp
| > | | >
| > | | > Hope helps. Thanks,
| > | | >
| > | | > Steven Cheng
| > | | > Microsoft Online Support
| > | | >
| > | | > Get Secure!
www.microsoft.com/security
| > | | > (This posting is provided "AS IS", with no warranties, and
confers
| > no
| > | | > rights.)
| > | | >
| > | | >
| > | | > --------------------
| > | | > | From: <
[email protected]>
| > | | > | Subject: datetime format in xml
| > | | > | Date: Tue, 8 Nov 2005 09:33:07 -0600
| > | | > | Lines: 16
| > | | > | X-Priority: 3
| > | | > | X-MSMail-Priority: Normal
| > | | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| > | | > | X-RFC2646: Format=Flowed; Original
| > | | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| > | | > | Message-ID: <
[email protected]>
| > | | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
| > | | > | NNTP-Posting-Host: corp.lazardgroup.com 64.237.78.178
| > | | > | Path:
| > TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | | > microsoft.public.dotnet.framework.aspnet.webservices:8304
| > | | > | X-Tomcat-NG:
microsoft.public.dotnet.framework.aspnet.webservices
| > | | > |
| > | | > | Hi all, I am consuming a web service on .net client side. I
| > generated
| > | | > the
| > | | > | proxy class and it has a custom object with a few datetime
| > properties.
| > | | > The
| > | | > | problem is when I populate some of those properties, the
| > underlying
| > | xml
| > | | > | serializer formats the property as outlined below
| > | | > |
| > | | > | 2005-11-07T18:34:36.6990563-06:00
| > | | > |
| > | | > | The problem is the WS needs it in the following format:-
| > | | > |
| > | | > | 2005-11-04T08:30:39
| > | | > |
| > | | > | Any ideas on how I can control this?
| > | | > |
| > | | > | TIA!
| > | | > |
| > | | > |
| > | | > |
| > | | >
| > | |
| > | |
| > | |
| > |
| > |
| >
|
|
|