Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 839993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:33:12+00:00 2026-05-15T05:33:12+00:00

I have an application written in .NETMF that requires that I be able to

  • 0

I have an application written in .NETMF that requires that I be able to parse an RFC822-Datetime.

Normally, this would be easy, but NETMF does not have a DateTime.parse() method, nor does it have some sort of a pattern matching implementation, so I’m pretty much stuck.

Any ideas?

EDIT: “Intelligent” solutions are probably needed. Part of the reason this is difficult is that the datetime in question has a tendency to have extra spaces in it (but only sometimes). A simple substring solution might work one day, but fail the next when the datetime has an extra space somewhere between the parts. I do not have control over the datetime, it is from the NOAA.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:33:13+00:00Added an answer on May 15, 2026 at 5:33 am

    Good ol’ string manipulation:

    Sun, 06 Jun 2010 20:07:44 +0000
              1         2         3
    0123456789012345678901234567890
    
    string x = Sanitize("  Sun,  06 \t Jun 2010 \r\n 20:07:44 +0000  ");
    
    int day    = int.Parse(x.Substring(5, 2));
    int month  = Array.IndexOf(months, x.Substring(8, 3)) + 1;
    int year   = int.Parse(x.Substring(12, 4));
    
    int hour   = int.Parse(x.Substring(17, 2));
    int minute = int.Parse(x.Substring(20, 2));
    int second = int.Parse(x.Substring(23, 2));
    
    int offsetSgn    = (x[26] == "-") ? -1 : 1;
    int offsetHour   = int.Parse(x.Substring(27, 2));
    int offsetMinute = int.Parse(x.Substring(29, 2));
    
    DateTime result = new DateTime(year, month, day, hour, minute, second, 0);
    TimeSpan offset = new TimeSpan(offsetHour, offsetMinute, 0);
    
    // TODO: add offset...
    

    with

    string[] months = new string[12];
    months[0] = "Jan";
    months[1] = "Feb";
    months[2] = "Mar";
    months[3] = "Apr";
    months[4] = "May";
    months[5] = "Jun";
    months[6] = "Jul";
    months[7] = "Aug";
    months[8] = "Sep";
    months[9] = "Oct";
    months[10] = "Nov";
    months[11] = "Dec";
    

    and

    string Sanitize(string s)
    {
        if (s == null)
        {
            return null;
        }
    
        char[] buffer = new char[s.Length];
        int pos = 0;
        bool inSpace = true;
    
        for (int i = 0; i < s.Length; i++)
        {
            if (s[i] == ' ' || s[i] == '\t' || s[i] == '\r' || s[i] == '\n')
            {
                if (!inSpace)
                {
                    buffer[pos] = ' ';
                    pos++;
                    inSpace = true;
                }
            }
            else
            {
                buffer[pos] = s[i];
                pos++;
                inSpace = false;
            }
        }
    
        return new string(buffer, 0, pos);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application written for the UK market that currently only supports English
We have an application written in .net, c#, winforms. We noticed that sometimes when
Background: I have an application written in Delphi that uses the Borland Database Engine
I have a media application (written in Delphi 2010 but I am not sure
I have an application written in C++. I've read some articles on how we
SA I have a application written in RubyonRails and I want to make him
I have a small application written in Play! which allows user registration and adding
I have a small application written in Python using Flask. Right now I'm running
I have my web application written in Spring MVC. It is quite simple app
I'm refactoring a medium-sized WinForms application written by other developers and almost every method

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.