1

I am currently consuming an RSS feed in .Net (luckily still testing).

I noticed that the feed was throwing an invalid datetime error.

It appears that .Net doesn't handle BST times as this is not a valid timezone in windows.

Take the following dates

Mon, 05 Oct 2009 08:00:06 GMT

Tue, 01 Apr 2014 17:00:00 BST

THe second string is not a valid datetime if you try to parse it using something like this

if (!DateTime.TryParse(dateString, out dt))
    dt = DateTime.ParseExact(dateString, CustomUtcDateTimeFormat, CultureInfo.InvariantCulture);

Is this really the case?

I know I can write something to remove the timezone but really?

72GM
  • 2,926
  • 3
  • 27
  • 33
  • 1
    Well what's `CustomUtcDateTimeFormat`? We don't have enough information at the moment to reproduce the problem. – Jon Skeet Apr 01 '14 at 18:13
  • 1
    possible duplicate of [C# british summer time (BST) timezone abbreviation](http://stackoverflow.com/questions/10126252/c-sharp-british-summer-time-bst-timezone-abbreviation) – Maurice Reeves Apr 01 '14 at 18:18
  • British Standard Time or Bangladesh Standard Time? CST is a dozy, it can mean 3 different zones. How do you expect .NET to tell the difference? It doesn't. – Hans Passant Apr 01 '14 at 18:41
  • Jon, quite simple to reproduce the problem, you'd think with all your points you'd be able to work that out? Hans, you and your comment are a waste of time. Maurice, thanks for your answer. It is a duplication I would say so you are correct. Not sure how I missed that. – 72GM Apr 02 '14 at 18:47

1 Answers1

1

Microsoft's .NET framework considers BST the same as GMT Daylight Time.

There is a more complete date and time management framework available for .NET, Noda Time.

Noda Time uses the TZ Database for its time zones, which includes BST.

ErikE
  • 48,881
  • 23
  • 151
  • 196
Erik Nedwidek
  • 6,134
  • 1
  • 25
  • 25