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

  • Home
  • SEARCH
  • 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 8811991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:29:53+00:00 2026-06-14T03:29:53+00:00

I am trying to sorty data using date column but the column is sorting

  • 0

I am trying to sorty data using date column but the column is sorting as string not as date. how to solve this problem?

Code:

var projection = Projections.SqlFunction("lower", NHibernateUtil.String,Projections.Property("datecolumn1"));

if(order="desc")queryOver = queryOver.OrderBy(projection).Desc;
else queryOver = queryOver.OrderBy(projection).Asc;

Result:(sorted by ascending)

8/7/2012 5:34 AM
11/7/2012 7:21 AM
11/7/2012 7:21 AM
11/7/2012 7:21 AM
11/7/2012 7:21 AM
8/27/2012 9:35 AM
  • 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-14T03:29:54+00:00Added an answer on June 14, 2026 at 3:29 am

    The snippet above shows that the there is a string projection. So the result is sorted as a set of string values. (and that could lead to different results dependent on sql server default DateTime.ToString format).

    To sort it by date add a different projection:

    var projection = Projections.Property("datecolumn1"));
    

    Now it should be ordered by native SQL Server DateTime type

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using cakePHP 1.26. I am trying to sort the data by Date
I am trying to sort data which is from Generic List object. By using
I am using celltable of GWT. And I am trying to sort a data
I am trying to sort data from on this page: http://www.excelwrestling.com/sortbymostwinsbyweight.php I want the
I'm trying to sort a column of data in a GTK tree view non-alphabetically.
I'm trying to append some data to a file, but in some cases want
Sorry this may be blatantly obvious but I have spent all morning trying to
I do not have any idea on how to sort data using datagridview in
I'm trying to compile a block of example code using Thrust in an attempt
i am trying to create a pdf email using data inputed into a html

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.