PC Review


Reply
Thread Tools Rate Thread

Convert DateTime to XML date type

 
 
ToChina
Guest
Posts: n/a
 
      7th Jun 2005
Hi, how can I convert a DateTime structure into the XML date type format?

i.e.

DateTime curDate = DateTime.Now;
????

into the string format:

yyyy-mm-dd



 
Reply With Quote
 
 
 
 
Ilya Tumanov [MS]
Guest
Posts: n/a
 
      7th Jun 2005
string s =
curDate.ToString("Whatever_Valid_Format_You_Need__See_VS_Documenytation_For_Formatting");

Or:

string s = XmlConvert.ToString(curDate)

That would be of this format, though: "yyyy-MM-ddTHH:mm:ss.fffffffzzzzzz".
That's the format used by WS and DataSet.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/...ramework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

"ToChina" <(E-Mail Removed)> wrote in message
news:7xjpe.46743$(E-Mail Removed)...
> Hi, how can I convert a DateTime structure into the XML date type format?
>
> i.e.
>
> DateTime curDate = DateTime.Now;
> ????
>
> into the string format:
>
> yyyy-mm-dd
>
>
>



 
Reply With Quote
 
=?Utf-8?B?QWxleCBZYWtobmluIFtNVlBd?=
Guest
Posts: n/a
 
      7th Jun 2005
string result = String.Format("{0:yyy-MM-dd}", DateTime.Now);

--
Alex Yakhnin, .NET CF MVP
www.intelliprog.com | www.opennetcf.org


"ToChina" wrote:

> Hi, how can I convert a DateTime structure into the XML date type format?
>
> i.e.
>
> DateTime curDate = DateTime.Now;
> ????
>
> into the string format:
>
> yyyy-mm-dd
>
>
>
>

 
Reply With Quote
 
Richard Lewis
Guest
Posts: n/a
 
      15th Jun 2005
Try

curDate.ToString("s");

Richard

ToChina wrote:

> Hi, how can I convert a DateTime structure into the XML date type
> format?
>
> i.e.
>
> DateTime curDate = DateTime.Now;
> ????
>
> into the string format:
>
> yyyy-mm-dd


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert a date string to datetime value with custom date format? ABC Microsoft C# .NET 1 29th Sep 2005 11:11 AM
How To Convert Excel Date Value to .Net DateTime? Gregg Walker Microsoft Excel Programming 5 19th Feb 2004 04:29 PM
How do I convert time_t data to DateTime type trellow Microsoft C# .NET 1 31st Dec 2003 04:11 PM
convert datetime type to string type in a dataset? tom Microsoft ADO .NET 1 10th Dec 2003 08:28 AM
Convert text to datetime type Ezekiël Microsoft Access ADP SQL Server 1 19th Nov 2003 05:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:34 PM.