473,698 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataSet, GetXml() and DateTime format

Suppose you have a DataTable which is part of a DataSet that has a
column of type DateTime.

When you call

ds.GetXml()

the date comes out looking something like this:

2005-01-17T23:01:34.952 6250+11:00

An article I came across
(http://www.c-sharpcorner.com/Code/20...eTimeInXml.asp)
says the format should be more like 'CCYY-MM-DDThh:mm:ss' but it clearly
isnt on my machine - I am getting to 1/10millionth of a second and the
timezone! That article suggests a way to customize the DateTime output
by calling ds.GetXml(), reading it back in, then writing it out again. I
don't really like that way.

I compared the output to all the DateTime.ToStri ng() variants and it
doesnt seem to match any! Looking at the DataSet schema didnt shed any
light either:

<xs:element name="Item" type="xs:dateTi me" minOccurs="0" />

Does anyone know of a way to output the DateTime in the format of your
choice? (without writing/reading back in)

I was thinking perhaps you can set the DateTime format as a property
somewhere on the DataSet, but can't find anything! There is much to this
class.
Regards

--
Wal
http://www.vooose.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
0 3443

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

Similar topics

0
1333
by: vavavoomy2 | last post by:
Hello, I have a dataset bound to some graphical controls, which I use to reorder the rows. My problem is when I get the dataset into XML format, The Xml rows are not ordered correctly-- they don't reflect the changes I made in ordering teh rows. OK, so row ordering is not guaranteed-- although I could have sworn I read it was in some documentation-- but anyway, how can I capture the row order? I don't want to explicitly keep an...
1
1621
by: Sunny | last post by:
Hi, I am trying to use the GetXml() function of my DataSet, and its returning all the rows and their values correctly in Elements format. How can i change this default behaviour of the GetXml() function to return the embedded nodes as an Attribute of an entity and not ChildNodes, e.g. The DataSet's GetXml function returns like this <File> <FileName>some.xml</FileName>
2
4383
by: Rajesh AVRS | last post by:
Hi guys I have a requirement where I needed to extract the DataSet contents as XML. After filling the dataset, I am calling GetXml() and is working fine. However, one of the column which I am querying, is CLOB data in XML format.
5
10627
by: moondaddy | last post by:
I'm caching a dataset in an asp.net session variable to hold a user's data. one data item I need to store is an image the user uploaded. My problem is that I don't know how to get the image into the dataset because I don't know what datatype to set the dataset column and then set this image to. I saw an example where someone defended a datatable in the global class and defined the column as an object, however, when I define a strongly...
3
4736
by: Chad | last post by:
I've run into a problem where I create a DataTable, Create an Integer column and assign the value DBNULL.Value to it. When I use the ds.GetXML to get the XML represnetation of this table, if the column contains only NULL values the column does not appear in the table. I would expect the column to appear with no value between the tags or some other convention used. This can't be working as intended, can it?! :-(
0
1266
by: samtilden | last post by:
We have upgraded our web project to Visual Studio 2005 (from VS 2003) and are still interfacing with some legacy ASP code that we do not want to change. The problem is that the VS 2003 compiler used to serialize a DateTime as: 2006-06-07T15:00:00.0000000-04:00 Now, VS 2005 compiler is serializing a DateTime as:
0
1451
by: samtilden | last post by:
We have upgraded our web project to Visual Studio 2005 (from VS 2003) and are still interfacing with some legacy ASP code that we do not want to change. The problem is that the VS 2003 compiler used to serialize a DateTime as: 2006-06-07T15:00:00.0000000-04:00
4
1969
by: SteveT | last post by:
I am wanting to populate several treeviews, one for the <TRs> group and one for the <TGsgroup. Is there a simplier way to populate the Treeview than the one I did below? It seems difficult to get to the correct DataSet values. <?xml version="1.0" encoding="utf-8" ?> <TestSample> <TRs> <TR1>
3
2098
by: Greg Collins [Microsoft MVP] | last post by:
I have a SQL2005 XML column I load into a DataSet. I then bind to a DataGrid. If I set an asp:Literal text value to the DataSet.GetXml() when I first load it into the DataSet, it displays correctly. If I later try to display the XML content in the asp:Literal control, then I get "<NewDataSet />". Why is that? Why can't I get the actual XML back from the DataSet? I'm new to DataSets, so I'm probably just missing something basic. Here's...
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9028
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
8895
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
8861
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...
1
6518
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
4369
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2001
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.