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 8601699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:54:17+00:00 2026-06-12T01:54:17+00:00

I have found a few threads that have dealt with this issue. Though, they

  • 0

I have found a few threads that have dealt with this issue. Though, they are not in a context that is usefull for me. Pretty much, I am trying to convert a DateTime to string, for rendering it into a MVCContrib Grid. Here is how things look inside of my model:

public IQueryable<FindStudentViewModel> GetStudentsProjected()
    {
        var projectedStudents= from p in FindAllStudents()
                                select new FindStudentViewModel
                                {
                                    StudentID = p.StudentID,
                                    FirstName = p.FirstName,
                                    LastName = p.LastName,
                                    EmailAddress = p.EmailAddress,
                                    CurrentCollege = p.CurrentCollege,
                                    IAUTerm = p.IAUTerm,
                                    IAUProgram = p.IAUProgram,
                                    InquirySource = p.InquirySource,
                                    InquiryDate = (string)p.InquiryDate.ToString(),
                                    Status = p.Status

                                };

        return projectedStudents;
    }

And of course, LINQ does not like this one bit. Pretty much, I need to be able to convert the InquiryDate into a string, and then order the results by InquiryDate. Thank you in advance.

  • 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-06-12T01:54:18+00:00Added an answer on June 12, 2026 at 1:54 am

    Ordering on a string representation of a DateTime might not be a very good plan. Consider the following dates:

    5/4/2007
    9/12/2011
    6/4/1904
    

    If you order them when they are DateTime type, you’ll get:

    6/4/1904
    5/4/2007
    9/12/2012
    

    If you use .ToString() on them, then order on it, you’ll get:

    5/4/2007
    6/4/1904
    9/12/2011
    

    Code to test with:

    var dates = new DateTime[] { new DateTime(2012, 9, 12), new DateTime(1904, 6, 4), new DateTime(2007, 5, 4) };
    foreach (var item in dates.OrderBy(d => d))
    {
        Console.WriteLine(item);
    }
    
    Console.WriteLine();
    var temp = dates.Select(d => d.ToString());
    foreach (var item in temp.OrderBy(d => d))
    {
        Console.WriteLine(item);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found a few threads in regards to this issue. Most people appear
I have found a few threads on various sites that seem to touch on
I'm trying to debug an issue. We have few Threads that work on data
This is similar to a few other threads i have found, but I haven't
I have already searched for this type of error and found a few threads,
I have checked few other posts and found some UIAnimation transitions that kind-of give
I may seem ignorant but I have not found much information about how to
I found a few threads on this using the search feature, but nothing for
I have found a few samples on how to use GameKit for bluetooth communication
I have question regarding disabling browser caching. I have already found few solutions, and

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.