472,353 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

How to parse this date: "2003-10-29T17:44+00:00"

Hello,

I have a date string in the following format: "2003-10-29T17:44+00:00"

When I put it to DateTime.Parse() method it throws an exception, how do I
parse this date format?

Thanks,

/m
Nov 15 '05 #1
4 4318
In DateTime.Parse you need to specify the FormatInfo. Create a custom
FormatInfo that defines the format you are using and when trying to use
DateTime.Parse() specify that format info

Thanks,
Jagan Mohan
"Muscha" <mu****@no.spam.net> wrote in message
news:u3**************@TK2MSFTNGP10.phx.gbl...
Hello,

I have a date string in the following format: "2003-10-29T17:44+00:00"

When I put it to DateTime.Parse() method it throws an exception, how do I
parse this date format?

Thanks,

/m

Nov 15 '05 #2
That format looks a lot like a xml date time format. Maybe you could try the
XmlConvert.ToDateTime() method in the System.Xml namespace.

Muscha wrote:
Hello,

I have a date string in the following format: "2003-10-29T17:44+00:00"

When I put it to DateTime.Parse() method it throws an exception, how
do I parse this date format?

Thanks,

/m

Nov 15 '05 #3
Sam
An alternative would be to do a string replace on the T
character, as replacing this with a space will allow it
to parse normally.

e.g. this works

string s = "2002-10-31T12:30+01:00";
s = s.Replace("T", " ");
t = DateTime.Parse(s);

Sam
-----Original Message-----
In DateTime.Parse you need to specify the FormatInfo. Create a customFormatInfo that defines the format you are using and when trying to useDateTime.Parse() specify that format info

Thanks,
Jagan Mohan
"Muscha" <mu****@no.spam.net> wrote in message
news:u3**************@TK2MSFTNGP10.phx.gbl...
Hello,

I have a date string in the following format: "2003-10- 29T17:44+00:00"
When I put it to DateTime.Parse() method it throws an exception, how do I parse this date format?

Thanks,

/m

.

Nov 15 '05 #4
Muscha,
Have you looked at DateTime.ParseExact with a custom format?

Something like (minimally tested in VB.NET):

string format = "yyyy-MM-ddTHH:mmzzz";
string s = "2003-10-29T17:44+00:00";

DateTime d = DateTime.ParseExact(s, format, null);

Which is very close to the "s" & "u" standard formats, except for the time
zone on the end...

Hope this helps
Jay

"Muscha" <mu****@no.spam.net> wrote in message
news:u3**************@TK2MSFTNGP10.phx.gbl...
Hello,

I have a date string in the following format: "2003-10-29T17:44+00:00"

When I put it to DateTime.Parse() method it throws an exception, how do I
parse this date format?

Thanks,

/m

Nov 15 '05 #5

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

Similar topics

70
by: Roy Yao | last post by:
Does it mean "(sizeof(int))* (p)" or "sizeof( (int)(*p) )" ? According to my analysis, operator sizeof, (type) and * have the same precedence,...
2
by: terry | last post by:
Hi, When I store cookie value "12:05:33" and read it again, I find the value become "12%3A05%3A33", how to read or convert it correctly? ...
3
by: Albert Wagner | last post by:
I have just had a problem that I cannot find any reference to in any docs. Admittedly, I am a JavaScript newbie, but this sure seems like a bug or...
3
by: Brad Quinn | last post by:
Is there a way to add an assembly to the .NET tab of the "Add Reference" dialog?
4
by: Peter Hemmingsen | last post by:
Hi, I have a dotnet object (implemented in mc++ and used in c#) which have a property called "Info". The Info property is also a dotnet object...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

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.