473,378 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Returning DateTime value ?

Hi,

Can a web service method return safely a DateTime value ? Would it cause
problems for non-.NET client proxy generators ?

Thanks

Navin
Nov 19 '05 #1
2 1576
Yes, it serializes datetime just fine. However: DateTime is always
serialized in local time, so if you consume/deserialize the soap
envelope in a different timezone you get a "different" datetime.

I put this in quotes because if you use local datetime, then it
represents the same point in time, just in different timezones. But if
you use a UTC datetime, .Net serializes it still as local time and you
really end up with a differnt datetime in a different timezone.

DateTime was not very well thought out in the first implementation and
mostly tuned for performance and compatibility, not for globalization.

More info on this issue:
http://blogs.msdn.com/bclteam/archiv...21/136918.aspx

To workaround this, tag the datetime as [XmlIgnore]/[SoapIgnore] and
instead serialize a string value of the datetime as described in the
above article.

I successfully used both approaches (DateTime serialization and
workaround) to create .Net webservices that are consumed by non .Net
clients (used Apache Axis and Glue Standard to create java stubs)

Nov 19 '05 #2
Thanks for response. The blog was very helpful. So, I understand it is safe
to return date time using the format yyyy-MM-ddTHH:mm:ss.fffffffzzz when
using local time. Would mobile toolkits like J2ME be able to consume this
format too ? And what about problem with COM and VBA clients as posted in
the blog ? Should the format always be yyyy-MM-dd HH:mm:ss ? But it doesn't
care of timezone.

Thanks again and regards

Navin
"Stefan" <Cl*********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Yes, it serializes datetime just fine. However: DateTime is always
serialized in local time, so if you consume/deserialize the soap
envelope in a different timezone you get a "different" datetime.

I put this in quotes because if you use local datetime, then it
represents the same point in time, just in different timezones. But if
you use a UTC datetime, .Net serializes it still as local time and you
really end up with a differnt datetime in a different timezone.

DateTime was not very well thought out in the first implementation and
mostly tuned for performance and compatibility, not for globalization.

More info on this issue:
http://blogs.msdn.com/bclteam/archiv...21/136918.aspx

To workaround this, tag the datetime as [XmlIgnore]/[SoapIgnore] and
instead serialize a string value of the datetime as described in the
above article.

I successfully used both approaches (DateTime serialization and
workaround) to create .Net webservices that are consumed by non .Net
clients (used Apache Axis and Glue Standard to create java stubs)

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dgaucher | last post by:
Hi, I want to consume a Web Service that returns a choice, but my C++ client always receives the same returned type. On the other hand, when I am using a Java client, it is working fine (of...
1
by: dkode8 | last post by:
Heres my problem, the first part selects a row from the database, if there is no row with the criteria it inserts a row and then returns it, the problem is the IF statement that inserts the row,...
1
by: Matthias De Ridder | last post by:
Hello, I really hope that someone will be able to help me, because I'm desperate now! I'm a student, graduating this year, and I'm working on a thesis where C# Web Services are involved. I...
6
by: SQL Server | last post by:
I've been working this for a while. Kind of new to SQL Server functions and not seeing what I am doing wrong. I have this function CREATE FUNCTION dbo.test (@Group varchar(50)) RETURNS...
1
by: Matt Kemmerer | last post by:
I'm trying to return a HashTable froma WebMethod. This fails with a not supported method because HashTable implements IDictionary. What I'm doing right now instead is stuffing my data into a...
8
by: Martin Z | last post by:
INSERT INTO dbo.Transmission (TransmissionDate, TransmissionDirection, Filename, TransmittedData) VALUES (@TransmissionDate,@TransmissionDirection,@Filename,@TransmittedData); SELECT @retVal =...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
7
by: axapta | last post by:
Hi, I have the following however the date is returned in the long format. I want to display as dd/mm/yyyy. If Not drReader.Item("offerstatusdate") Is DBNull.Value Then txtOfferStatusDate.Text =...
2
by: gabosom | last post by:
Hi! I've been breaking my head trying to get the output variables from my Stored Procedure. This is my SP code CREATE PROCEDURE GetKitchenOrderDetail( @idService int, --outPut Variables ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.