0

I have a calculated field in a document library that takes the "Modified" property makes a more readable date from it. The problem is, the column is now sorting alphabetically, even though the data type is set to "date and time" and the format is set to "date only".

enter image description here

How can I modify this so that it will show a 'friendly' date, but still sort by actual DATE?

1

You're using TEXT, which makes it un-sortable. You'd have to be using =DATE(MONTH(Modified),DAY(Modified),YEAR(Modified))
or similar. I doubt you can get the behavior you're looking for with the 'long month' without setting all your dates to this format (regional settings).

0

You can still sort by the Modified field, which is indexed and very well suitable for sorting.

  • I don't wish to display the modified field in the view though... Ideally, I would like this "Friendly" format to sort by date. – Kolten Oct 8 '14 at 16:58
  • You don't have to display the field to make a view sorted by its value. – Alexey Krasheninnikov Oct 9 '14 at 8:22
  • I see what you meant - unfortunately a 'permanent' type sort isn't what I am after either - sorry I should have been more clear. I wish the user to have the ability to sort it themselves by clicking the column headers. – Kolten Oct 9 '14 at 14:47
0

Instead of creating a calculated column with the same data in text format, you can use Client Side Rendering and JSLink to create javascript Date objects for each Modified column value and format the date to your preference such as

var modified = $(selector).text();
var date = (new Date(modified)).format("MMMM dd, yyyy");
  • Your screenshot suggests version 2010 where CSR is not yet implemented, but upgrade may be a question of time and this solution may be a motivator for upgrading. – Alexey Krasheninnikov Oct 10 '14 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.