473,412 Members | 2,048 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,412 software developers and data experts.

DateTime Issue

4
Take a look at the blog - http://feeds.gawker.com/gizmodo/full

Look under the <pubDate>. Most of them appears as -

<pubDate>Wed, 17 Jan 2007 09:18:15 EST</pubDate>

When parsing this date using - (in .net 1.1)

DateTime dt = DateTime.Parse("Wed, 17 Jan 2007 09:18:15 EST");

It fails. However if I put in "GMT" instead of "EST" or "PST" etc., the above statement will pass without any problem.

How can I handle so many different variations? This particular blog have this situation and some others may have completely different thing.

Any help would be greatly appreciated. Thanks.
Jan 17 '07 #1
3 1189
misogsk
39
Take a look at the blog - http://feeds.gawker.com/gizmodo/full

Look under the <pubDate>. Most of them appears as -

<pubDate>Wed, 17 Jan 2007 09:18:15 EST</pubDate>

When parsing this date using - (in .net 1.1)

DateTime dt = DateTime.Parse("Wed, 17 Jan 2007 09:18:15 EST");

It fails. However if I put in "GMT" instead of "EST" or "PST" etc., the above statement will pass without any problem.

How can I handle so many different variations? This particular blog have this situation and some others may have completely different thing.

Any help would be greatly appreciated. Thanks.
There's one way(not much nice,but...) replace the last three letters with GMT. Trim the last three letters and then append to that string a "GMT". Not very nice, but still function.
Jan 17 '07 #2
nukiee
4
There's one way(not much nice,but...) replace the last three letters with GMT. Trim the last three letters and then append to that string a "GMT". Not very nice, but still function.
But in that case if the time is actually a GMT time and I am parsing it in EST, I will miss interpret the time - isn't that correct?
Jan 17 '07 #3
kenobewan
4,871 Expert 4TB
I believe that GMT is now called UTC - try using the DateTime.ToUniversalTime method to convert a local DateTime to its UTC equivalent.

Hope that this helps.
Jan 18 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Fritz Switzer | last post by:
I'd like to have a string assigned the value of a DateTime.AddMinutes(amount) so that the string is formatted in "HH:MM" format. For example: DateTime.Now.AddMinutes(30) returns "00:30" ...
3
by: Andrew S. Giles | last post by:
Hello, I am importing a flat text file, and putting it into a datagrid for display on a form. Currently the users have their dates and times seperated. I have two fields, therefore in the...
5
by: I am Sam | last post by:
I have created this DateTime object and instanced it I think correctly DateTime myClubNow1=new...
9
by: Phil B | last post by:
I am having a problem with a datetime from a web services provider The provider is sending the following SOAP response <?xml version="1.0" encoding="utf-8"?> <soap:Envelope...
10
by: Newbie | last post by:
howdy... i am trying to execute a statement where i insert a record with datetime values into a sql database. Dim sqlcmd As New SqlCommand sqlcmd.CommandText = "update tbl_event set...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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...

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.