neo dapi
neo dapi

Reputation: 11

c# webservice client - date format

I'm writing a c# app that consumes a web service with datetime type parameter in yyyy-MM-ddTHH:mm:ss format. Notice that the parameter is "DateTime" type in web service hence I dont have control over how this type will get formatted when its converted to XML internally.

Can anyone provide a clue on how we can ensure that our web service calls send datetime in required format?

Upvotes: 1

Views: 3396

Answers (1)

fixagon
fixagon

Reputation: 5566

If you send the parameter as an object of the type DateTime you dont have to worry, the DateTime Object stores the data internally not as a string. You just have to make sure that at the moment when you create your client side DateTime object you parse it correctly.

EDIT: of course the parsing of the date in a test-interface (where you enter a string) will not be the same as when you pass directly a datetime object to the client proxy...

what you asked in your comment: to supress the timezone which gets added you can set the attribute dateTimeSerialization to local. But I dont think thats a good idea. just better use localized dates everywhere. more information

Upvotes: 2

Related Questions