473,663 Members | 2,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1590
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.fff ffffzzz 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*********@gm ail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.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
510
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 course, the generated proxy is not the same). When I am looking at the C++ generated code, it seems fine, but when I am executing the code, I always get the first choice type.
1
1592
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, never returns the select after it. if there is a row initially in the database, it returns the right information, I just can't get it to return the row after inserting it. Anyone know what the problem could be? Stored procedure: ALTER...
1
2062
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 only have three weeks to finish it all! My GUI and Web services were finished, but I hadn't tested them. So I linked the GUI to the Web service and started testing them.
6
7647
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 smalldatetime AS BEGIN Declare @retVal varchar(10) (SELECT @retVal= MIN() FROM dbo.t_master_schedules WHERE (event_id = 13) AND (group_ =@Group)) return convert(smalldatetime, @retVal, 1)
1
11286
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 DataSet and then extracting my data from the DataSet on the other side. What I want to know is this: What is the easiest way to return something similar to an associative array (HashTable) from a web service.
8
13929
by: Martin Z | last post by:
INSERT INTO dbo.Transmission (TransmissionDate, TransmissionDirection, Filename, TransmittedData) VALUES (@TransmissionDate,@TransmissionDirection,@Filename,@TransmittedData); SELECT @retVal = SCOPE_IDENTITY(); Pretty simple. There is an additional TransmissionID column that is an autonumber and primary key. @retVal is always null in my table adapter function, where I'm setting @retval (in the Parameters
0
4092
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 with my problems. Now for my new little problem,I had a problem posting the values from checkbox fields to a database and thats the obstacle I overcame. Now the second part is my new problem is that I want that the next time that page loads for...
7
7701
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 = drReader.Item("offerstatusdate") End If Regards
2
3372
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 @idUser int OUTPUT,
0
8771
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8548
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8634
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7371
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5657
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4182
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4349
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1757
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.