g | x | w | all
Bytes Lang Time Link
035JavaScript Node.js200428T070730ZArnauld
006Uiua241207T160140Znyxbird
063AWK241206T211340Zxrs
067C gcc Little Endian Byte Order200428T102816ZNoodle9
464Deadfish~210224T091300Zemanresu
050C gcc m32200429T064056Zdingledo
nan200429T144511Zbthota
036R English locale200429T095948ZJDL
030R200428T082333ZBart-Jan
027Java JDK200428T192021ZOlivier
039PHP200428T155950ZKaddath
023Powershell200428T235220ZCpt.Whal
026Retina 0.8.2200428T151010Zmath jun
059Python 3200428T220826ZQwertiy
029Perl 5200428T102840ZNeil
049TSQL200428T184706ZBradC
008Japt200428T161120ZShaggy
004MATL200428T122600ZLuis Men
00605AB1E200428T065421Zuser9206
037JavaScript200428T072025ZSteve Be
025Charcoal200428T092809ZNeil
002Pyke200428T082322Zthe defa
040Retina200428T081151ZNeil
058Kotlin200428T080314Zsidgate
038Python 3200428T072726Zdingledo
020Factor200428T075548ZGalen Iv
010J200428T074338ZGalen Iv
043Python 2200428T070226ZSurculos
024Red200428T073228ZGalen Iv
007Pyth200428T071359Zisaacg
008MathGolf200428T072547Zmaxb
019APL Dyalog Unicode 18.0 beta200428T063819ZAdá
021APL Dyalog Unicode200428T072212ZAdá
015Keg200428T065426Zlyxal
035APL Dyalog Unicode200428T065524ZAdá
027Wolfram Language Mathematica200428T064506ZZaMoC
029Bash + Unix utilities200428T065923ZMitchell

JavaScript (Node.js),  37 36  35 bytes

This should also work in Chrome and Edge (Chromium)

Returns a list of strings.

a=>a.sort().sort(_=>-(a=a*595|5)%7)

Try it online!

How?

We first sort the input array in lexicographical order. Whatever the input is, we get:

Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday

We then invoke sort() a second time with a callback function that, while ignoring its input, generates a sequence of positive and negative values in such a way that the underlying sorting algorithm (insertion sort) is tricked into putting the array in the desired order.

Below is a summary of all steps. Note that because of the bitwise OR, the value stored in \$a\$ is always coerced to a signed 32-bit integer (and so are the 3rd and 4th columns in this table).

  A  |  B  | previous a  | -(a*595|5)  | mod 7 | new order
-----+-----+-------------+-------------+-------+-----------------------------------
 Fri | Mon |  NaN        | -5          |  -5   | Mon Fri Sat Sun Thu Tue Wed
 Mon | Sat |  5          | -2975       |   0   | unchanged
 Fri | Sat |  2975       | -1770125    |   0   | unchanged
 Fri | Sun |  1770125    | -1053224375 |   0   | unchanged
 Sat | Sun |  1053224375 |  396722091  |   3   | unchanged
 Sat | Thu | -396722091  | -173557135  |  -3   | Mon Fri Thu Sat Sun Tue Wed
 Fri | Thu |  173557135  | -187280221  |  -2   | Mon Thu Fri Sat Sun Tue Wed
 Mon | Thu |  187280221  |  237418201  |   6   | unchanged
 Fri | Tue | -237418201  | -470091173  |  -6   | Mon Thu Tue Fri Sat Sun Wed
 Thu | Tue |  470091173  | -531373695  |  -6   | Mon Tue Thu Fri Sat Sun Wed
 Mon | Tue |  531373695  |  1660231379 |   2   | unchanged
 Fri | Wed | -1660231379 | -4807575    |  -3   | Mon Tue Thu Wed Fri Sat Sun
 Tue | Wed |  4807575    |  1434460171 |   4   | unchanged
 Thu | Wed | -1434460171 | -1194690159 |  -5   | Mon Tue Wed Thu Fri Sat Sun

Uiua, 6 bytes

↻1Days

Boring builtin answer (Days starts with "Sunday", so it needs to be ↻ rotated). You can append ◌ pop for +1 byte if taking input is required.

(Slightly) more interesting 13-byte answer:

⊏∵⋕"1564023"⍆

Selects the correct indices from the sorted input using an array of digits.

Try all three!

AWK, 63 bytes

$0=gensub(/X/,"day ","g","MonXTueXWednesXThursXFriXSaturXSunX")

Attempt This Online!

C (gcc) Little Endian Byte Order, 123 \$\cdots\$ 85 67 bytes

c(int**a,int**b){a=**a%274%79-**b%274%79;}f(int*s){qsort(s,7,8,c);}

Try it online!

Saved a whopping 18 bytes - and made it shorter than just printing days - thanks to ceilingcat!!!

Function f takes a list of strings as input and sorts it.

How

Reads the first four characters as a 32-bit int, \$i\$, and then calculates \$((i\mod{274})\mod{79})\$:

Monday -> 5
Tuesday -> 7
Wednesday -> 11
Thursday -> 23
Friday -> 47
Saturday -> 59
Sunday -> 61

Then uses qsort to sort the array.

Previous solution

C (gcc), 72 70 bytes

Saved 2 bytes thanks to gastropner!!!

f(){puts("Monday Tuesday Wednesday Thursday Friday Saturday Sunday");}

Try it online!

Just prints the days of the week.
Unfortunately Fortunately this is isn't shorter than sorting the input! All thanks to ceilingcat!! :)))

Deadfish~, 464 bytes

{{i}dd}dddc{i}{i}{i}iiiicdc{d}cdddc{i}{i}iiiic{{d}}{d}dc{{i}ddd}iiiic{i}{i}{i}iiic{d}ddddddc{i}iiiic{d}dddddcdddc{i}{i}iiiic{{d}}{d}dc{{i}dd}dddc{i}iiiicdc{i}c{d}ic{i}iiiic{d}dddddcdddc{i}{i}iiiic{{d}}{d}dc{{i}ddd}iiiic{i}{i}c{i}iiicdddcic{d}dddddcdddc{i}{i}iiiic{{d}}{d}dc{{i}dddd}c{{i}dddddd}iiiic{d}icdddddcdddc{i}{i}iiiic{{d}}{d}dc{{i}ddd}iiic{i}iiiic{i}{i}dcicdddc{d}ddddcdddc{i}{i}iiiic{{d}}{d}dc{{i}ddd}iiic{i}{i}{i}iiiic{d}iiic{d}cdddc{i}{i}iiiic{{d}}{d}dc

Try it online!

Deadfish - the worst compression algorithm.

C (gcc) -m32, 50 bytes

main(i){for(;puts(nl_langinfo(131079+i%7))-i++;);}

Try it online!

Explanation

Simply put, nl_langinfo() is a useful function which returns a particular string given an argument. It just turns out that the argument to pass for obtaining weekday names is 131079 ... 131086. One other thing is that we must add the flag -m32, which is explained nicely in this answer.

Python

Input: Space separated strings

Once the input is sorted then the output should be ordered using indices [1, 5, 6, 4, 0, 2, 3] of the sorted array

inp=sorted(input().split())
for i in [1, 5, 6, 4, 0, 2, 3]:
  print(inp[i])

Try it here

R (English locale), 36 bytes

weekdays(.leap.seconds[c(8:12,6:7)])

Not quite as short as the other answer, but I posted it because it makes use of one of the strangest objects kicking around in base R — a list of all the leap seconds. It so happens that leap seconds frequently occur in increasing sequences of days so we only have to take two "chunks" from the list.

Luckily, the leap seconds object has the oldest leap second first, so I don't have to qualify this program with "will only work for the next 2–3 years"!

TIO link here.

R, 30 bytes

Assuming an English locale

weekdays(as.Date("1/1/1")+0:6)

Try it online!

January 1st of the year 1 is a Monday (according to R).

Java (JDK), 27 bytes

java.time.DayOfWeek::values

Try it online!

Doing this because the challenge input is very structured, but the output is not structured at all.

No built-ins, 49 bytes

l->l.sort((a,b)->~a[0]*a[4]%-473-~b[0]*b[4]%-473)

Try it online!

PHP, 39 bytes

for(;$i<7;)echo" ".jddayofweek($i++,1);

Try it online!

Works in Windows but not in TIO, gotta find how to activate the extension.. takes no input.

We could save 4 bytes with an empty delimiter (which is "some delimiter" the question doesn't say a non-empty delimiter) but I'm not that nasty..

EDIT: version that works universally for 1 byte more

PHP, 40 bytes

for(;$i<7;)echo date("l ",1e6+$i++*8e4);

Try it online!

Powershell, 23 bytes

1..6+0|%{[DayOfWeek]$_}

Convert integers to weekday, but bump array by one because .net prefers Sundays.

37 bytes sorting

($args|%{[DayOfWeek]$_}|sort)[1..6+0]

input is string list to args.

Retina 0.8.2, 32 29 27 26 bytes

Tu
13
T`MWT`E
O`
T`d`MTWuT

Try it online!

Approach: Replace the first letter of the days with A, B, C, etc. so we can sort them lexicographically. Replace the M in Monday with a 0, the T in Tuesday with a 1, the W in Wednesday with a 2, and the T in Thursday with 4. To help golf off a byte, also replace the u in Tuesday with 3

Tu
13
T`MWT`E

Perform the replacements described above (The E inserts even numbers 02468)

O`

Sort lexicographically. At this point, our list of words looks like this:

0onday
13esday
2ednesday
4hursday
Friday
Saturday
Sunday

Notice that Friday, Saturday, and Sunday are already conveniently in alphabetical order.

T`d`MTWuT

Undo the transformations we performed above (The d inserts the range 0-9)

Python 3, 64 62 59 chars

Takes input as a list of strings, sorts it inplace:

lambda l:l.sort(key=lambda x:'uehrau'.find(x[1],x[0]=='S'))

Try it: https://ideone.com/rYxtff

Perl 5, 33 29 bytes

print+(sort<>)[1,5,6,4,0,2,3]

Try it online! Just another sort/permute answer. Edit: Saved 4 bytes thanks to @Xcali.

T-SQL, 49 bytes

SELECT DATENAME(w,RANK()OVER(ORDER BY d)-1)FROM t

Input is taken as a pre-existing table t with varchar column d, per our IO standards.

My code doesn't actually use the values in the input table in any way, so the input order doesn't matter (nor do the actual strings, they just have to be distinct). Instead, it uses the fact that it has 7 rows, along with the RANK() function, to generate the numbers 1 through 7.

After subtracting 1, these numbers are implicitly cast as dates (0=Mon Jan 1, 0001, 6=Sun Jan 7, 0001), and the DATENAME function returns the corresponding day of the week.

Japt, 8 bytes

n á g#4

Try it here

MATL, 4 bytes

23Y2

Built-in ¯\_(ツ)_/¯. Takes no input.

Try it online!

05AB1E, 6 bytes

Port of isaacg's base conversion answer.

Σ₁ö29%

Try it online!

Explanation

Σ      Filter the input by this function:
 ₁ö    Base-convert it from 256
   ₁   Constant 256
    Ì  Add 2 (= 258)
     % Modulo by this number

05AB1E, 6 bytes

-1 byte thanks to Expired Data

{œŽ5dè

Try it online!

05AB1E, 21 bytes

Σ"TuWeThFrSaSu"2ôåāsÏ

Try it online!

Explanation

Σ                     Sort by the output of this function.
 "TuWeThFrSaSu"2ô     Split every item of that by length of 2.
                 å    Contains?
                  āsÏ Find all truthy indices of that.

JavaScript, 37 characters

e=>[...'1564023'].map(a=>e.sort()[a])

JavaScript, 38 characters

e=>[1,5,6,4,0,2,3].map(a=>e.sort()[a])

Javascript, 39 characters

e=>e.map((a,i)=>e.sort()['1564023'[i]])

Javascript, 45 characters

e=>e.map((a,i)=>e.sort()[[1,5,6,4,0,2,3][i]])

Javascript, 51 characters

e=>(v=e.sort(),v.map((a,i)=>v[[1,5,6,4,0,2,3][i]]))

Javascript, 52 characters

e=>(v=e.sort(),[v[1],v[5],v[6],v[4],v[0],v[2],v[3]])

Javascript, 61 characters

I tried a couple of things, but they were fractionally longer than:

z=>'Monday Tuesday Wednesday Thursday Friday Saturday Sunday'

Charcoal, 29 25 bytes

≔E⁷SθW⁻θυ⊞υ⌊ιE1564023§υIι

Try it online! Link is to verbose version of code. Explanation:

≔E⁷Sθ

Input the seven days.

W⁻θυ⊞υ⌊ι

Sort the days lexicographically.

E1564023§υIι

Apply the permutation to the array.

Pyke, 2 bytes

Pyke has some weird constant built-ins (a link to the Stack Exchange API, the lengths of months as numbers, the names of the days of the week and so on).

~C

Doesn't take input. Try it online!

Retina, 40 bytes

^
MTuWThFSaSu
,6L$s`(.+)(?=.*(\1\w+))
$2

Try it online! Link shuffles input in header. Explanation:

^
MTuWThFSaSu

Insert unique day name abbreviations.

,6L$s`(.+)(?=.*(\1\w+))
$2

Find the first seven duplicate substrings, and output the word containing the duplicate, thus unabbreviating the names.

Kotlin , 58 bytes

DayOfWeek.values().map{it.name.toLowerCase().capitalize()}

Python 3, 40 38 bytes

-2 bytes thanks to xnor

from calendar import*;print(*day_name)

Try it online!


Python 2, 44 43 bytes

lambda d:sorted(d,key=lambda x:~hash(x)%72)

Try it online!

Factor, 20 bytes

day-names 1 rotate .

Try it online!

Factor has a built-in sequence for the days of the week, but is starts with Sunday - that's why I need to rotate the items to the right.

J, 10 bytes

1314 A./:~

Try it online!

J Port of isaacg's alternative Pyth solution — please upvote him!

Python 2, 45 43 bytes

-2 bytes thanks to @xnor!

lambda l:map(sorted(l).pop,[1,4,4,3,0,0,0])

Try it online!

Sort by normal string comparison first, then look up the correct permutation.


Python 3, 58 bytes

lambda l:sorted(l,key=lambda s:"TuWeThFrSaSu".find(s[:2]))

Try it online!

Use the first 2 letters of each day to look up the order.

Red, 24 bytes

print system/locale/days

Try it online!

Pyth, 7 bytes

o%CN258

Try it online!

Convert each string to a number via treating its ASCII codes as a base 256 number, then take that mod 258, and sort. This gives the mapping

['Monday', 49]
['Tuesday', 75]
['Wednesday', 89]
['Thursday', 99]
['Friday', 103]
['Saturday', 125]
['Sunday', 211]

Same length but less fun is

.P1314S

The 1314th permutation of the sorted input in lexicographic order.

MathGolf, 8 bytes

á{$ûÞ♠$%

Try it online!

Explanation

á{         sort by the output given from a code block
  $        convert to ordinal (base 256)
   ûÞ♠     push "Þ♠"
      $    convert to ordinal (gives 1791)
       %   modulo

I had the exact same idea as isaacg's Pyth answer, but in MathGolf I had to use another modulo. I tried every number up to 1000000, and noticed that the ordinal strings for each weekday ended up in the correct order for sorting when taking them modulo 1791.

APL (Dyalog Unicode) 18.0 beta, 19 bytes

Full program, taking no input.

'Dddd'(1200⌶)⍳7

Returns a list of strings:

┌──────┬───────┬─────────┬────────┬──────┬────────┬──────┐
│Monday│Tuesday│Wednesday│Thursday│Friday│Saturday│Sunday│
└──────┴───────┴─────────┴────────┴──────┴────────┴──────┘

⍳7 Integers 1…7, representing the dates Jan 1–7, 1900

(1200⌶)Format Date-time ("12:00") as follows:

'Dddd' long Day name

APL (Dyalog Unicode), 21 bytes

Anonymous prefix lambda. Port of isaacg's Pyth solution — go upvote that!

{⍵[⍋258|256⊥¨⎕UCS¨⍵]}

Try it online!

{} "dfn"; argument is :

⍵[] reorder the argument into the following order:

  ⎕UCS¨⍵ Universal Character Set code points of each string

  256⊥¨ evaluate each in base-256

  258| the division remainder when divided by 258

   grade (permutation that would sort it)

Keg, 15 bytes

“jnsDt[rƳm⑺dQ7⅍

Try it online!

You'd think this was some sort of fancy sorting algorithm, but no. It's simply a compressed string.

APL (Dyalog Unicode), 35 bytes

Anonymous prefix lambda. This one actually sorts its argument and doesn't use any "cheating" built-ins.

{⍵[⍋((∊∘⎕A⊂⊢)'MoTuWeThFrSa')⍳2↑¨⍵]}

Try it online!

{} "dfn"; argument is :

⍵[] reorder the argument into the following order:

  2↑¨ take the first two letters from each input day name

  ()⍳ find the index in the following list (missing items become 1 beyond last index)

   ()'MoTuWeThFrSa' apply the following tacit function to this string:

     the argument

     split on

    ∊∘⎕A membership of the uppercase Alphabet

   grade (permutation that would sort it)

Wolfram Language (Mathematica), 27 bytes

DayName@{#}&/@198~Range~204

Try it online!

Bash + Unix utilities, 29 bytes

jot "-wdate +%%A -d7-1-" 7|sh

Try it online!