It's a yearly task, alright












8












$begingroup$


Given a number 1≤n≤365, output the nth day of the year in "Day-numberth Month" format. For example, given 1, you should output "1st January", without "of".



The Gregorian calendar will be used and the program should not account for leap years, so your program should never output "29th February" in any circumstance. Any method can be used, as long as it follows the "Day-numberth Month" format mentioned before. Your program should also output ordinals correctly, meaning it should always output 1st, 2nd, 3rd, should 1, 2 or 3 respectively be the day numbers for any input. Leading spaces or other indentation are allowed.



This is code golf, so the shortest solution by characters wins.



Test cases:



1 gives 1st January
2 gives 2nd January
3 gives 3rd January
365 gives 31st December
60 gives 1st March
11 gives 11th January









share|improve this question











$endgroup$












  • $begingroup$
    What is "Day-number Month" format? I'm assuming it's "20th March"? Or is it "20 March"? That makes a pretty big difference, if you need ordinals.
    $endgroup$
    – Riker
    12 hours ago






  • 3




    $begingroup$
    Also, do you need to force an error message on numbers > 365? Can the program just assume that's invalid input and it won't need to handle that?
    $endgroup$
    – Riker
    12 hours ago






  • 4




    $begingroup$
    As not everyone is a native English speaker, you may want to add that day numbers 11, 12, and 13 get "th", numbers ending in "1" get "st", "2" get "nd", "3" get "rd", and all other get "th".
    $endgroup$
    – Adám
    12 hours ago






  • 4




    $begingroup$
    Whoa, don't accept answers so quickly. Especially not wrong answers!
    $endgroup$
    – Adám
    11 hours ago






  • 3




    $begingroup$
    You should add at least 11 (11th January) and 21 (21st January) to the test cases.
    $endgroup$
    – Arnauld
    11 hours ago
















8












$begingroup$


Given a number 1≤n≤365, output the nth day of the year in "Day-numberth Month" format. For example, given 1, you should output "1st January", without "of".



The Gregorian calendar will be used and the program should not account for leap years, so your program should never output "29th February" in any circumstance. Any method can be used, as long as it follows the "Day-numberth Month" format mentioned before. Your program should also output ordinals correctly, meaning it should always output 1st, 2nd, 3rd, should 1, 2 or 3 respectively be the day numbers for any input. Leading spaces or other indentation are allowed.



This is code golf, so the shortest solution by characters wins.



Test cases:



1 gives 1st January
2 gives 2nd January
3 gives 3rd January
365 gives 31st December
60 gives 1st March
11 gives 11th January









share|improve this question











$endgroup$












  • $begingroup$
    What is "Day-number Month" format? I'm assuming it's "20th March"? Or is it "20 March"? That makes a pretty big difference, if you need ordinals.
    $endgroup$
    – Riker
    12 hours ago






  • 3




    $begingroup$
    Also, do you need to force an error message on numbers > 365? Can the program just assume that's invalid input and it won't need to handle that?
    $endgroup$
    – Riker
    12 hours ago






  • 4




    $begingroup$
    As not everyone is a native English speaker, you may want to add that day numbers 11, 12, and 13 get "th", numbers ending in "1" get "st", "2" get "nd", "3" get "rd", and all other get "th".
    $endgroup$
    – Adám
    12 hours ago






  • 4




    $begingroup$
    Whoa, don't accept answers so quickly. Especially not wrong answers!
    $endgroup$
    – Adám
    11 hours ago






  • 3




    $begingroup$
    You should add at least 11 (11th January) and 21 (21st January) to the test cases.
    $endgroup$
    – Arnauld
    11 hours ago














8












8








8





$begingroup$


Given a number 1≤n≤365, output the nth day of the year in "Day-numberth Month" format. For example, given 1, you should output "1st January", without "of".



The Gregorian calendar will be used and the program should not account for leap years, so your program should never output "29th February" in any circumstance. Any method can be used, as long as it follows the "Day-numberth Month" format mentioned before. Your program should also output ordinals correctly, meaning it should always output 1st, 2nd, 3rd, should 1, 2 or 3 respectively be the day numbers for any input. Leading spaces or other indentation are allowed.



This is code golf, so the shortest solution by characters wins.



Test cases:



1 gives 1st January
2 gives 2nd January
3 gives 3rd January
365 gives 31st December
60 gives 1st March
11 gives 11th January









share|improve this question











$endgroup$




Given a number 1≤n≤365, output the nth day of the year in "Day-numberth Month" format. For example, given 1, you should output "1st January", without "of".



The Gregorian calendar will be used and the program should not account for leap years, so your program should never output "29th February" in any circumstance. Any method can be used, as long as it follows the "Day-numberth Month" format mentioned before. Your program should also output ordinals correctly, meaning it should always output 1st, 2nd, 3rd, should 1, 2 or 3 respectively be the day numbers for any input. Leading spaces or other indentation are allowed.



This is code golf, so the shortest solution by characters wins.



Test cases:



1 gives 1st January
2 gives 2nd January
3 gives 3rd January
365 gives 31st December
60 gives 1st March
11 gives 11th January






code-golf date






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 11 hours ago







Andrew

















asked 12 hours ago









AndrewAndrew

867




867












  • $begingroup$
    What is "Day-number Month" format? I'm assuming it's "20th March"? Or is it "20 March"? That makes a pretty big difference, if you need ordinals.
    $endgroup$
    – Riker
    12 hours ago






  • 3




    $begingroup$
    Also, do you need to force an error message on numbers > 365? Can the program just assume that's invalid input and it won't need to handle that?
    $endgroup$
    – Riker
    12 hours ago






  • 4




    $begingroup$
    As not everyone is a native English speaker, you may want to add that day numbers 11, 12, and 13 get "th", numbers ending in "1" get "st", "2" get "nd", "3" get "rd", and all other get "th".
    $endgroup$
    – Adám
    12 hours ago






  • 4




    $begingroup$
    Whoa, don't accept answers so quickly. Especially not wrong answers!
    $endgroup$
    – Adám
    11 hours ago






  • 3




    $begingroup$
    You should add at least 11 (11th January) and 21 (21st January) to the test cases.
    $endgroup$
    – Arnauld
    11 hours ago


















  • $begingroup$
    What is "Day-number Month" format? I'm assuming it's "20th March"? Or is it "20 March"? That makes a pretty big difference, if you need ordinals.
    $endgroup$
    – Riker
    12 hours ago






  • 3




    $begingroup$
    Also, do you need to force an error message on numbers > 365? Can the program just assume that's invalid input and it won't need to handle that?
    $endgroup$
    – Riker
    12 hours ago






  • 4




    $begingroup$
    As not everyone is a native English speaker, you may want to add that day numbers 11, 12, and 13 get "th", numbers ending in "1" get "st", "2" get "nd", "3" get "rd", and all other get "th".
    $endgroup$
    – Adám
    12 hours ago






  • 4




    $begingroup$
    Whoa, don't accept answers so quickly. Especially not wrong answers!
    $endgroup$
    – Adám
    11 hours ago






  • 3




    $begingroup$
    You should add at least 11 (11th January) and 21 (21st January) to the test cases.
    $endgroup$
    – Arnauld
    11 hours ago
















$begingroup$
What is "Day-number Month" format? I'm assuming it's "20th March"? Or is it "20 March"? That makes a pretty big difference, if you need ordinals.
$endgroup$
– Riker
12 hours ago




$begingroup$
What is "Day-number Month" format? I'm assuming it's "20th March"? Or is it "20 March"? That makes a pretty big difference, if you need ordinals.
$endgroup$
– Riker
12 hours ago




3




3




$begingroup$
Also, do you need to force an error message on numbers > 365? Can the program just assume that's invalid input and it won't need to handle that?
$endgroup$
– Riker
12 hours ago




$begingroup$
Also, do you need to force an error message on numbers > 365? Can the program just assume that's invalid input and it won't need to handle that?
$endgroup$
– Riker
12 hours ago




4




4




$begingroup$
As not everyone is a native English speaker, you may want to add that day numbers 11, 12, and 13 get "th", numbers ending in "1" get "st", "2" get "nd", "3" get "rd", and all other get "th".
$endgroup$
– Adám
12 hours ago




$begingroup$
As not everyone is a native English speaker, you may want to add that day numbers 11, 12, and 13 get "th", numbers ending in "1" get "st", "2" get "nd", "3" get "rd", and all other get "th".
$endgroup$
– Adám
12 hours ago




4




4




$begingroup$
Whoa, don't accept answers so quickly. Especially not wrong answers!
$endgroup$
– Adám
11 hours ago




$begingroup$
Whoa, don't accept answers so quickly. Especially not wrong answers!
$endgroup$
– Adám
11 hours ago




3




3




$begingroup$
You should add at least 11 (11th January) and 21 (21st January) to the test cases.
$endgroup$
– Arnauld
11 hours ago




$begingroup$
You should add at least 11 (11th January) and 21 (21st January) to the test cases.
$endgroup$
– Arnauld
11 hours ago










12 Answers
12






active

oldest

votes


















6












$begingroup$

Google Sheets, 26 bytes



Thanks to my colleague Richard for spotting an error.



Takes input in cell A1.



=TEXT(1+A1,"d""th"" mmmm")


Try it online!



Google Sheets represents dates with 1 being 31st December 1899, so this adds one to the day number and formats appropriately.



The formula does not work in Microsoft Excel because it counter-factually calculates 1900 as a leap year.






share|improve this answer











$endgroup$





















    3












    $begingroup$

    Hack, 115 59 39 bytes





    $x==>date("jS F",mktime(0,0,0,1,$x));


    Since @gwaugh got to the same solution as mine while I was golfing, I'm posting this in Hack instead :).






    share|improve this answer











    $endgroup$













    • $begingroup$
      Wow, great minds think alike. :) +1 to you sir!
      $endgroup$
      – gwaugh
      11 hours ago










    • $begingroup$
      @gwaugh haha, I didn't know I could just have a top-level program. I'll edit mine to make it top-level too, and find a way to get a better scor e;-)
      $endgroup$
      – Ven
      11 hours ago






    • 1




      $begingroup$
      @gwaugh Made mine Hack instead.
      $endgroup$
      – Ven
      11 hours ago










    • $begingroup$
      You'll probably want to specify a non-leap year parameter to your mktime() call otherwise it will return the wrong output if run on a leap year. (had to do to my answer).
      $endgroup$
      – gwaugh
      11 hours ago



















    2












    $begingroup$


    Python 3.8 (pre-release), 112 bytes





    lambda x:str(d:=(t:=gmtime(x*86399)).tm_mday)+'tsnrhtdd'[d%5*(d%30%20<4)::4]+strftime(' %B',t)
    from time import*


    Try it online!



    Weirdly enough, I don't have to parenthesize d:=(t:=gmtime(~-x*86400), probably because the interpreter only checks if there are () characters around the assignment expression and not that the expression itself is parenthesized.



    -2 thanks to gwaugh.

    -5 thanks to xnor.






    share|improve this answer











    $endgroup$





















      1












      $begingroup$


      PHP, 38 40 30 28 bytes





      <?=date("jS F",86399*$argn);


      Try it online!



      Run with php -nF input is from STDIN. Example (above script named y.php):



      $ echo 1|php -nF y.php
      1st January
      $ echo 2| php -nF y.php
      2nd January
      $ echo 3| php -nF y.php
      3rd January
      $ echo 11|php -nF y.php
      11th January
      $ echo 21|php -nF y.php
      21st January
      $ echo 60|php -nF y.php
      1st March
      $ echo 365|php -nF y.php
      31st December


      Explanation



      Construct an epoch timestamp for the desired day in 1970 (conveniently not a leap year) by multiplying the day number * number of seconds per day (86400). However, this would yield one day higher so instead multiply by number of seconds in a day - 1 (86399) which for the range of input numbers (1≤n≤365) will result with the timestamp of the end of each correct day. Then just use PHP's built-in date formatting for output.






      share|improve this answer











      $endgroup$













      • $begingroup$
        why's the -n necessary?
        $endgroup$
        – Ven
        11 hours ago










      • $begingroup$
        @Ven it might not be in all cases, but just disables any settings in local php.ini that might create inconsistent behavior.
        $endgroup$
        – gwaugh
        11 hours ago



















      1












      $begingroup$

      JavaScript (ES6), 117 bytes





      d=>(n=(d=new Date(1,0,d)).getDate())+([,'st','nd','rd'][n%30%20]||'th')+' '+d.toLocaleDateString('en',{month:'long'})


      Try it online!



      Commented



      d =>                     // d = input day
      ( n = //
      ( d = // convert d to
      new Date(1, 0, d) // a Date object for the non leap year 1901
      ).getDate() // save the corresponding day of month into n
      ) + ( //
      [, 'st', 'nd', 'rd'] // ordinal suffixes
      [n % 30 % 20] // map { 1, 2, 3, 21, 22, 23, 31 } to { 'st', 'nd', 'rd' }
      || 'th' // or use 'th' for everything else
      ) + ' ' + // append a space
      d.toLocaleDateString( // convert d to ...
      'en', // ... the English ...
      { month: 'long' } // ... month name
      ) //




      Without date built-ins, 188 bytes





      f=(d,m=0)=>d>(k=31-(1115212>>m*2&3))?f(d-k,m+1):d+([,'st','nd','rd'][d%30%20]||'th')+' '+`JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember`.match(/.[a-z]*/g)[m]


      Try it online!






      share|improve this answer











      $endgroup$













      • $begingroup$
        Fails for 11th,12th,13th of each month
        $endgroup$
        – Expired Data
        12 hours ago






      • 1




        $begingroup$
        @ExpiredData Thanks for reporting this. Fixed now.
        $endgroup$
        – Arnauld
        11 hours ago










      • $begingroup$
        Ignore my comment, I made an ID10T error.
        $endgroup$
        – asgallant
        6 hours ago










      • $begingroup$
        I'm not sure how nodejs handle language tags, but it seems using 0 would work as using "en". And changing to toLocaleString would save 4 bytes. 110 bytes
        $endgroup$
        – tsh
        1 hour ago



















      1












      $begingroup$


      R, 158 134 bytes



      -24 bytes @Nick Kennedy for golfing the 'st', 'nd', 'rd', & 'th'. Thanks!





      f=format;paste0(a<-as.double(f(d<-as.Date(scan(,''),'%j'),'%e')),`if`((a-1)%%10>2|a%/%10==1,'th',c("st","nd","rd")[a%%10]),f(d,' %B'))


      Try it online!






      share|improve this answer











      $endgroup$













      • $begingroup$
        How about tio.run/##HYxBCsIwEEWvIoEwMzDVRldi40K8hQgdmwQV20oSd949xm4e/… for 134 bytes
        $endgroup$
        – Nick Kennedy
        9 hours ago










      • $begingroup$
        Yes, I need to learn `if` better. Thanks.
        $endgroup$
        – CT Hall
        7 hours ago





















      1












      $begingroup$

      Shell + coreutils, 112 bytes





      date -d1969-12-31 $1days +%-dth %B|sed -e s/1th/1st/ -e s/2th/2nd/ -e s/3th/3rd/ -e 's/(1.).. /1th /'


      Try it online! Explanation:



      date -d1969-12-31 $1days


      Calculate the number of days after the first day preceding a non-leap year. (Sadly you can't do relative date calculations from @-1.)



      +%-dth %B|sed


      Output the day of month (without leading zero), th, and the full month name.



      -e s/1th/1st/ -e s/2th/2nd/ -e s/3th/3rd/


      Fix up 1st, 2nd, 3rd, 21st, 22nd, 23rd and 31st.



      -e 's/(1.).. /1th /'


      Restore 11th to 13th.






      share|improve this answer









      $endgroup$





















        0












        $begingroup$


        C# (Visual C# Interactive Compiler), 141 139 133 124 122 bytes





        a=>{var d=s.AddDays(a-1);int x=d.Day,m=x%30%20;return x+"thstndrd".Substring(m<4?m*2:0,2)+d.ToString(" MMMM");};DateTime s


        Thanks to Arnauld for faster method of removing 11,12,13th saving 4 bytes



        Try it online!






        share|improve this answer










        New contributor




        Expired Data is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        $endgroup$













        • $begingroup$
          Using C# 8, this can be reduced to: a=>{var d=s.AddDays(a-1);int x=d.Day,m=x%30%20;return x+"thstndrd"[(m<4?m*2:0)..2]+$" {d:MMMM}";};DateTime s The interactive compiler doesn't seem to support changing its language level to "preview" at this time, though.
          $endgroup$
          – briman0094
          9 hours ago












        • $begingroup$
          116 bytes
          $endgroup$
          – Embodiment of Ignorance
          8 hours ago










        • $begingroup$
          I'm pretty sure you have to add a semi-colon after the DataTime s
          $endgroup$
          – Embodiment of Ignorance
          2 hours ago



















        0












        $begingroup$


        C# (Visual C# Interactive Compiler), 115 bytes





        n=>{var g=p.AddDays(n-1);int f=g.Day,m=f%20%30<4?f%10:0;return f+$"{"tsnr"[m]+""+"htdd"[m]} {g:MMMM}";};DateTime p;


        Try it online!






        share|improve this answer











        $endgroup$





















          0












          $begingroup$


          Jelly, 115 114 bytes



          ’%⁵<3a:⁵n1Ɗ×%⁵$Ḥ+ؽị“thstndrd”ṭ
          “5<Ḟ’b4+28ÄŻ_@µ>0T,>0$ƇZṪµ1ịị“1;8-UÞẆĊƬṁɱkzIṇkµ⁴ JḷJdɱ<©Q£Ƈ.dẊṘh!İḞẠƒĊ¶÷»Ỵ¤,2ịÇƊṚK


          Try it online!



          Long by Jelly standards, but done from first principles.






          share|improve this answer











          $endgroup$





















            0












            $begingroup$


            Perl 6, 166 161 bytes





            {~(.day~(<th st nd rd>[.day%30%20]||'th'),<January February March April May June July August September October November December>[.month-1])}o*+Date.new(1,1,1)-1


            Try it online!



            Hardcodes all the month names, which takes up most of the space. Man, Perl 6 really needs a proper date formatter.






            share|improve this answer











            $endgroup$













            • $begingroup$
              My previous answer did the same :-(
              $endgroup$
              – Ven
              4 hours ago



















            0












            $begingroup$

            Smalltalk, 101 bytes



            d:=Date year:1day:n.m:=d dayOfMonth.o:={#st.#nd.#rd}at:m\10ifAbsent:#th.m asString,o,' ',d monthName





            share|improve this answer









            $endgroup$













              Your Answer





              StackExchange.ifUsing("editor", function () {
              return StackExchange.using("mathjaxEditing", function () {
              StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
              StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
              });
              });
              }, "mathjax-editing");

              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "200"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f181468%2fits-a-yearly-task-alright%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              12 Answers
              12






              active

              oldest

              votes








              12 Answers
              12






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              6












              $begingroup$

              Google Sheets, 26 bytes



              Thanks to my colleague Richard for spotting an error.



              Takes input in cell A1.



              =TEXT(1+A1,"d""th"" mmmm")


              Try it online!



              Google Sheets represents dates with 1 being 31st December 1899, so this adds one to the day number and formats appropriately.



              The formula does not work in Microsoft Excel because it counter-factually calculates 1900 as a leap year.






              share|improve this answer











              $endgroup$


















                6












                $begingroup$

                Google Sheets, 26 bytes



                Thanks to my colleague Richard for spotting an error.



                Takes input in cell A1.



                =TEXT(1+A1,"d""th"" mmmm")


                Try it online!



                Google Sheets represents dates with 1 being 31st December 1899, so this adds one to the day number and formats appropriately.



                The formula does not work in Microsoft Excel because it counter-factually calculates 1900 as a leap year.






                share|improve this answer











                $endgroup$
















                  6












                  6








                  6





                  $begingroup$

                  Google Sheets, 26 bytes



                  Thanks to my colleague Richard for spotting an error.



                  Takes input in cell A1.



                  =TEXT(1+A1,"d""th"" mmmm")


                  Try it online!



                  Google Sheets represents dates with 1 being 31st December 1899, so this adds one to the day number and formats appropriately.



                  The formula does not work in Microsoft Excel because it counter-factually calculates 1900 as a leap year.






                  share|improve this answer











                  $endgroup$



                  Google Sheets, 26 bytes



                  Thanks to my colleague Richard for spotting an error.



                  Takes input in cell A1.



                  =TEXT(1+A1,"d""th"" mmmm")


                  Try it online!



                  Google Sheets represents dates with 1 being 31st December 1899, so this adds one to the day number and formats appropriately.



                  The formula does not work in Microsoft Excel because it counter-factually calculates 1900 as a leap year.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 11 hours ago

























                  answered 12 hours ago









                  AdámAdám

                  28.8k276204




                  28.8k276204























                      3












                      $begingroup$

                      Hack, 115 59 39 bytes





                      $x==>date("jS F",mktime(0,0,0,1,$x));


                      Since @gwaugh got to the same solution as mine while I was golfing, I'm posting this in Hack instead :).






                      share|improve this answer











                      $endgroup$













                      • $begingroup$
                        Wow, great minds think alike. :) +1 to you sir!
                        $endgroup$
                        – gwaugh
                        11 hours ago










                      • $begingroup$
                        @gwaugh haha, I didn't know I could just have a top-level program. I'll edit mine to make it top-level too, and find a way to get a better scor e;-)
                        $endgroup$
                        – Ven
                        11 hours ago






                      • 1




                        $begingroup$
                        @gwaugh Made mine Hack instead.
                        $endgroup$
                        – Ven
                        11 hours ago










                      • $begingroup$
                        You'll probably want to specify a non-leap year parameter to your mktime() call otherwise it will return the wrong output if run on a leap year. (had to do to my answer).
                        $endgroup$
                        – gwaugh
                        11 hours ago
















                      3












                      $begingroup$

                      Hack, 115 59 39 bytes





                      $x==>date("jS F",mktime(0,0,0,1,$x));


                      Since @gwaugh got to the same solution as mine while I was golfing, I'm posting this in Hack instead :).






                      share|improve this answer











                      $endgroup$













                      • $begingroup$
                        Wow, great minds think alike. :) +1 to you sir!
                        $endgroup$
                        – gwaugh
                        11 hours ago










                      • $begingroup$
                        @gwaugh haha, I didn't know I could just have a top-level program. I'll edit mine to make it top-level too, and find a way to get a better scor e;-)
                        $endgroup$
                        – Ven
                        11 hours ago






                      • 1




                        $begingroup$
                        @gwaugh Made mine Hack instead.
                        $endgroup$
                        – Ven
                        11 hours ago










                      • $begingroup$
                        You'll probably want to specify a non-leap year parameter to your mktime() call otherwise it will return the wrong output if run on a leap year. (had to do to my answer).
                        $endgroup$
                        – gwaugh
                        11 hours ago














                      3












                      3








                      3





                      $begingroup$

                      Hack, 115 59 39 bytes





                      $x==>date("jS F",mktime(0,0,0,1,$x));


                      Since @gwaugh got to the same solution as mine while I was golfing, I'm posting this in Hack instead :).






                      share|improve this answer











                      $endgroup$



                      Hack, 115 59 39 bytes





                      $x==>date("jS F",mktime(0,0,0,1,$x));


                      Since @gwaugh got to the same solution as mine while I was golfing, I'm posting this in Hack instead :).







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited 11 hours ago

























                      answered 12 hours ago









                      VenVen

                      2,32511123




                      2,32511123












                      • $begingroup$
                        Wow, great minds think alike. :) +1 to you sir!
                        $endgroup$
                        – gwaugh
                        11 hours ago










                      • $begingroup$
                        @gwaugh haha, I didn't know I could just have a top-level program. I'll edit mine to make it top-level too, and find a way to get a better scor e;-)
                        $endgroup$
                        – Ven
                        11 hours ago






                      • 1




                        $begingroup$
                        @gwaugh Made mine Hack instead.
                        $endgroup$
                        – Ven
                        11 hours ago










                      • $begingroup$
                        You'll probably want to specify a non-leap year parameter to your mktime() call otherwise it will return the wrong output if run on a leap year. (had to do to my answer).
                        $endgroup$
                        – gwaugh
                        11 hours ago


















                      • $begingroup$
                        Wow, great minds think alike. :) +1 to you sir!
                        $endgroup$
                        – gwaugh
                        11 hours ago










                      • $begingroup$
                        @gwaugh haha, I didn't know I could just have a top-level program. I'll edit mine to make it top-level too, and find a way to get a better scor e;-)
                        $endgroup$
                        – Ven
                        11 hours ago






                      • 1




                        $begingroup$
                        @gwaugh Made mine Hack instead.
                        $endgroup$
                        – Ven
                        11 hours ago










                      • $begingroup$
                        You'll probably want to specify a non-leap year parameter to your mktime() call otherwise it will return the wrong output if run on a leap year. (had to do to my answer).
                        $endgroup$
                        – gwaugh
                        11 hours ago
















                      $begingroup$
                      Wow, great minds think alike. :) +1 to you sir!
                      $endgroup$
                      – gwaugh
                      11 hours ago




                      $begingroup$
                      Wow, great minds think alike. :) +1 to you sir!
                      $endgroup$
                      – gwaugh
                      11 hours ago












                      $begingroup$
                      @gwaugh haha, I didn't know I could just have a top-level program. I'll edit mine to make it top-level too, and find a way to get a better scor e;-)
                      $endgroup$
                      – Ven
                      11 hours ago




                      $begingroup$
                      @gwaugh haha, I didn't know I could just have a top-level program. I'll edit mine to make it top-level too, and find a way to get a better scor e;-)
                      $endgroup$
                      – Ven
                      11 hours ago




                      1




                      1




                      $begingroup$
                      @gwaugh Made mine Hack instead.
                      $endgroup$
                      – Ven
                      11 hours ago




                      $begingroup$
                      @gwaugh Made mine Hack instead.
                      $endgroup$
                      – Ven
                      11 hours ago












                      $begingroup$
                      You'll probably want to specify a non-leap year parameter to your mktime() call otherwise it will return the wrong output if run on a leap year. (had to do to my answer).
                      $endgroup$
                      – gwaugh
                      11 hours ago




                      $begingroup$
                      You'll probably want to specify a non-leap year parameter to your mktime() call otherwise it will return the wrong output if run on a leap year. (had to do to my answer).
                      $endgroup$
                      – gwaugh
                      11 hours ago











                      2












                      $begingroup$


                      Python 3.8 (pre-release), 112 bytes





                      lambda x:str(d:=(t:=gmtime(x*86399)).tm_mday)+'tsnrhtdd'[d%5*(d%30%20<4)::4]+strftime(' %B',t)
                      from time import*


                      Try it online!



                      Weirdly enough, I don't have to parenthesize d:=(t:=gmtime(~-x*86400), probably because the interpreter only checks if there are () characters around the assignment expression and not that the expression itself is parenthesized.



                      -2 thanks to gwaugh.

                      -5 thanks to xnor.






                      share|improve this answer











                      $endgroup$


















                        2












                        $begingroup$


                        Python 3.8 (pre-release), 112 bytes





                        lambda x:str(d:=(t:=gmtime(x*86399)).tm_mday)+'tsnrhtdd'[d%5*(d%30%20<4)::4]+strftime(' %B',t)
                        from time import*


                        Try it online!



                        Weirdly enough, I don't have to parenthesize d:=(t:=gmtime(~-x*86400), probably because the interpreter only checks if there are () characters around the assignment expression and not that the expression itself is parenthesized.



                        -2 thanks to gwaugh.

                        -5 thanks to xnor.






                        share|improve this answer











                        $endgroup$
















                          2












                          2








                          2





                          $begingroup$


                          Python 3.8 (pre-release), 112 bytes





                          lambda x:str(d:=(t:=gmtime(x*86399)).tm_mday)+'tsnrhtdd'[d%5*(d%30%20<4)::4]+strftime(' %B',t)
                          from time import*


                          Try it online!



                          Weirdly enough, I don't have to parenthesize d:=(t:=gmtime(~-x*86400), probably because the interpreter only checks if there are () characters around the assignment expression and not that the expression itself is parenthesized.



                          -2 thanks to gwaugh.

                          -5 thanks to xnor.






                          share|improve this answer











                          $endgroup$




                          Python 3.8 (pre-release), 112 bytes





                          lambda x:str(d:=(t:=gmtime(x*86399)).tm_mday)+'tsnrhtdd'[d%5*(d%30%20<4)::4]+strftime(' %B',t)
                          from time import*


                          Try it online!



                          Weirdly enough, I don't have to parenthesize d:=(t:=gmtime(~-x*86400), probably because the interpreter only checks if there are () characters around the assignment expression and not that the expression itself is parenthesized.



                          -2 thanks to gwaugh.

                          -5 thanks to xnor.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited 5 hours ago

























                          answered 7 hours ago









                          Erik the OutgolferErik the Outgolfer

                          32.4k429105




                          32.4k429105























                              1












                              $begingroup$


                              PHP, 38 40 30 28 bytes





                              <?=date("jS F",86399*$argn);


                              Try it online!



                              Run with php -nF input is from STDIN. Example (above script named y.php):



                              $ echo 1|php -nF y.php
                              1st January
                              $ echo 2| php -nF y.php
                              2nd January
                              $ echo 3| php -nF y.php
                              3rd January
                              $ echo 11|php -nF y.php
                              11th January
                              $ echo 21|php -nF y.php
                              21st January
                              $ echo 60|php -nF y.php
                              1st March
                              $ echo 365|php -nF y.php
                              31st December


                              Explanation



                              Construct an epoch timestamp for the desired day in 1970 (conveniently not a leap year) by multiplying the day number * number of seconds per day (86400). However, this would yield one day higher so instead multiply by number of seconds in a day - 1 (86399) which for the range of input numbers (1≤n≤365) will result with the timestamp of the end of each correct day. Then just use PHP's built-in date formatting for output.






                              share|improve this answer











                              $endgroup$













                              • $begingroup$
                                why's the -n necessary?
                                $endgroup$
                                – Ven
                                11 hours ago










                              • $begingroup$
                                @Ven it might not be in all cases, but just disables any settings in local php.ini that might create inconsistent behavior.
                                $endgroup$
                                – gwaugh
                                11 hours ago
















                              1












                              $begingroup$


                              PHP, 38 40 30 28 bytes





                              <?=date("jS F",86399*$argn);


                              Try it online!



                              Run with php -nF input is from STDIN. Example (above script named y.php):



                              $ echo 1|php -nF y.php
                              1st January
                              $ echo 2| php -nF y.php
                              2nd January
                              $ echo 3| php -nF y.php
                              3rd January
                              $ echo 11|php -nF y.php
                              11th January
                              $ echo 21|php -nF y.php
                              21st January
                              $ echo 60|php -nF y.php
                              1st March
                              $ echo 365|php -nF y.php
                              31st December


                              Explanation



                              Construct an epoch timestamp for the desired day in 1970 (conveniently not a leap year) by multiplying the day number * number of seconds per day (86400). However, this would yield one day higher so instead multiply by number of seconds in a day - 1 (86399) which for the range of input numbers (1≤n≤365) will result with the timestamp of the end of each correct day. Then just use PHP's built-in date formatting for output.






                              share|improve this answer











                              $endgroup$













                              • $begingroup$
                                why's the -n necessary?
                                $endgroup$
                                – Ven
                                11 hours ago










                              • $begingroup$
                                @Ven it might not be in all cases, but just disables any settings in local php.ini that might create inconsistent behavior.
                                $endgroup$
                                – gwaugh
                                11 hours ago














                              1












                              1








                              1





                              $begingroup$


                              PHP, 38 40 30 28 bytes





                              <?=date("jS F",86399*$argn);


                              Try it online!



                              Run with php -nF input is from STDIN. Example (above script named y.php):



                              $ echo 1|php -nF y.php
                              1st January
                              $ echo 2| php -nF y.php
                              2nd January
                              $ echo 3| php -nF y.php
                              3rd January
                              $ echo 11|php -nF y.php
                              11th January
                              $ echo 21|php -nF y.php
                              21st January
                              $ echo 60|php -nF y.php
                              1st March
                              $ echo 365|php -nF y.php
                              31st December


                              Explanation



                              Construct an epoch timestamp for the desired day in 1970 (conveniently not a leap year) by multiplying the day number * number of seconds per day (86400). However, this would yield one day higher so instead multiply by number of seconds in a day - 1 (86399) which for the range of input numbers (1≤n≤365) will result with the timestamp of the end of each correct day. Then just use PHP's built-in date formatting for output.






                              share|improve this answer











                              $endgroup$




                              PHP, 38 40 30 28 bytes





                              <?=date("jS F",86399*$argn);


                              Try it online!



                              Run with php -nF input is from STDIN. Example (above script named y.php):



                              $ echo 1|php -nF y.php
                              1st January
                              $ echo 2| php -nF y.php
                              2nd January
                              $ echo 3| php -nF y.php
                              3rd January
                              $ echo 11|php -nF y.php
                              11th January
                              $ echo 21|php -nF y.php
                              21st January
                              $ echo 60|php -nF y.php
                              1st March
                              $ echo 365|php -nF y.php
                              31st December


                              Explanation



                              Construct an epoch timestamp for the desired day in 1970 (conveniently not a leap year) by multiplying the day number * number of seconds per day (86400). However, this would yield one day higher so instead multiply by number of seconds in a day - 1 (86399) which for the range of input numbers (1≤n≤365) will result with the timestamp of the end of each correct day. Then just use PHP's built-in date formatting for output.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited 9 hours ago

























                              answered 11 hours ago









                              gwaughgwaugh

                              1,613515




                              1,613515












                              • $begingroup$
                                why's the -n necessary?
                                $endgroup$
                                – Ven
                                11 hours ago










                              • $begingroup$
                                @Ven it might not be in all cases, but just disables any settings in local php.ini that might create inconsistent behavior.
                                $endgroup$
                                – gwaugh
                                11 hours ago


















                              • $begingroup$
                                why's the -n necessary?
                                $endgroup$
                                – Ven
                                11 hours ago










                              • $begingroup$
                                @Ven it might not be in all cases, but just disables any settings in local php.ini that might create inconsistent behavior.
                                $endgroup$
                                – gwaugh
                                11 hours ago
















                              $begingroup$
                              why's the -n necessary?
                              $endgroup$
                              – Ven
                              11 hours ago




                              $begingroup$
                              why's the -n necessary?
                              $endgroup$
                              – Ven
                              11 hours ago












                              $begingroup$
                              @Ven it might not be in all cases, but just disables any settings in local php.ini that might create inconsistent behavior.
                              $endgroup$
                              – gwaugh
                              11 hours ago




                              $begingroup$
                              @Ven it might not be in all cases, but just disables any settings in local php.ini that might create inconsistent behavior.
                              $endgroup$
                              – gwaugh
                              11 hours ago











                              1












                              $begingroup$

                              JavaScript (ES6), 117 bytes





                              d=>(n=(d=new Date(1,0,d)).getDate())+([,'st','nd','rd'][n%30%20]||'th')+' '+d.toLocaleDateString('en',{month:'long'})


                              Try it online!



                              Commented



                              d =>                     // d = input day
                              ( n = //
                              ( d = // convert d to
                              new Date(1, 0, d) // a Date object for the non leap year 1901
                              ).getDate() // save the corresponding day of month into n
                              ) + ( //
                              [, 'st', 'nd', 'rd'] // ordinal suffixes
                              [n % 30 % 20] // map { 1, 2, 3, 21, 22, 23, 31 } to { 'st', 'nd', 'rd' }
                              || 'th' // or use 'th' for everything else
                              ) + ' ' + // append a space
                              d.toLocaleDateString( // convert d to ...
                              'en', // ... the English ...
                              { month: 'long' } // ... month name
                              ) //




                              Without date built-ins, 188 bytes





                              f=(d,m=0)=>d>(k=31-(1115212>>m*2&3))?f(d-k,m+1):d+([,'st','nd','rd'][d%30%20]||'th')+' '+`JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember`.match(/.[a-z]*/g)[m]


                              Try it online!






                              share|improve this answer











                              $endgroup$













                              • $begingroup$
                                Fails for 11th,12th,13th of each month
                                $endgroup$
                                – Expired Data
                                12 hours ago






                              • 1




                                $begingroup$
                                @ExpiredData Thanks for reporting this. Fixed now.
                                $endgroup$
                                – Arnauld
                                11 hours ago










                              • $begingroup$
                                Ignore my comment, I made an ID10T error.
                                $endgroup$
                                – asgallant
                                6 hours ago










                              • $begingroup$
                                I'm not sure how nodejs handle language tags, but it seems using 0 would work as using "en". And changing to toLocaleString would save 4 bytes. 110 bytes
                                $endgroup$
                                – tsh
                                1 hour ago
















                              1












                              $begingroup$

                              JavaScript (ES6), 117 bytes





                              d=>(n=(d=new Date(1,0,d)).getDate())+([,'st','nd','rd'][n%30%20]||'th')+' '+d.toLocaleDateString('en',{month:'long'})


                              Try it online!



                              Commented



                              d =>                     // d = input day
                              ( n = //
                              ( d = // convert d to
                              new Date(1, 0, d) // a Date object for the non leap year 1901
                              ).getDate() // save the corresponding day of month into n
                              ) + ( //
                              [, 'st', 'nd', 'rd'] // ordinal suffixes
                              [n % 30 % 20] // map { 1, 2, 3, 21, 22, 23, 31 } to { 'st', 'nd', 'rd' }
                              || 'th' // or use 'th' for everything else
                              ) + ' ' + // append a space
                              d.toLocaleDateString( // convert d to ...
                              'en', // ... the English ...
                              { month: 'long' } // ... month name
                              ) //




                              Without date built-ins, 188 bytes





                              f=(d,m=0)=>d>(k=31-(1115212>>m*2&3))?f(d-k,m+1):d+([,'st','nd','rd'][d%30%20]||'th')+' '+`JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember`.match(/.[a-z]*/g)[m]


                              Try it online!






                              share|improve this answer











                              $endgroup$













                              • $begingroup$
                                Fails for 11th,12th,13th of each month
                                $endgroup$
                                – Expired Data
                                12 hours ago






                              • 1




                                $begingroup$
                                @ExpiredData Thanks for reporting this. Fixed now.
                                $endgroup$
                                – Arnauld
                                11 hours ago










                              • $begingroup$
                                Ignore my comment, I made an ID10T error.
                                $endgroup$
                                – asgallant
                                6 hours ago










                              • $begingroup$
                                I'm not sure how nodejs handle language tags, but it seems using 0 would work as using "en". And changing to toLocaleString would save 4 bytes. 110 bytes
                                $endgroup$
                                – tsh
                                1 hour ago














                              1












                              1








                              1





                              $begingroup$

                              JavaScript (ES6), 117 bytes





                              d=>(n=(d=new Date(1,0,d)).getDate())+([,'st','nd','rd'][n%30%20]||'th')+' '+d.toLocaleDateString('en',{month:'long'})


                              Try it online!



                              Commented



                              d =>                     // d = input day
                              ( n = //
                              ( d = // convert d to
                              new Date(1, 0, d) // a Date object for the non leap year 1901
                              ).getDate() // save the corresponding day of month into n
                              ) + ( //
                              [, 'st', 'nd', 'rd'] // ordinal suffixes
                              [n % 30 % 20] // map { 1, 2, 3, 21, 22, 23, 31 } to { 'st', 'nd', 'rd' }
                              || 'th' // or use 'th' for everything else
                              ) + ' ' + // append a space
                              d.toLocaleDateString( // convert d to ...
                              'en', // ... the English ...
                              { month: 'long' } // ... month name
                              ) //




                              Without date built-ins, 188 bytes





                              f=(d,m=0)=>d>(k=31-(1115212>>m*2&3))?f(d-k,m+1):d+([,'st','nd','rd'][d%30%20]||'th')+' '+`JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember`.match(/.[a-z]*/g)[m]


                              Try it online!






                              share|improve this answer











                              $endgroup$



                              JavaScript (ES6), 117 bytes





                              d=>(n=(d=new Date(1,0,d)).getDate())+([,'st','nd','rd'][n%30%20]||'th')+' '+d.toLocaleDateString('en',{month:'long'})


                              Try it online!



                              Commented



                              d =>                     // d = input day
                              ( n = //
                              ( d = // convert d to
                              new Date(1, 0, d) // a Date object for the non leap year 1901
                              ).getDate() // save the corresponding day of month into n
                              ) + ( //
                              [, 'st', 'nd', 'rd'] // ordinal suffixes
                              [n % 30 % 20] // map { 1, 2, 3, 21, 22, 23, 31 } to { 'st', 'nd', 'rd' }
                              || 'th' // or use 'th' for everything else
                              ) + ' ' + // append a space
                              d.toLocaleDateString( // convert d to ...
                              'en', // ... the English ...
                              { month: 'long' } // ... month name
                              ) //




                              Without date built-ins, 188 bytes





                              f=(d,m=0)=>d>(k=31-(1115212>>m*2&3))?f(d-k,m+1):d+([,'st','nd','rd'][d%30%20]||'th')+' '+`JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember`.match(/.[a-z]*/g)[m]


                              Try it online!







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited 9 hours ago

























                              answered 12 hours ago









                              ArnauldArnauld

                              78.6k795327




                              78.6k795327












                              • $begingroup$
                                Fails for 11th,12th,13th of each month
                                $endgroup$
                                – Expired Data
                                12 hours ago






                              • 1




                                $begingroup$
                                @ExpiredData Thanks for reporting this. Fixed now.
                                $endgroup$
                                – Arnauld
                                11 hours ago










                              • $begingroup$
                                Ignore my comment, I made an ID10T error.
                                $endgroup$
                                – asgallant
                                6 hours ago










                              • $begingroup$
                                I'm not sure how nodejs handle language tags, but it seems using 0 would work as using "en". And changing to toLocaleString would save 4 bytes. 110 bytes
                                $endgroup$
                                – tsh
                                1 hour ago


















                              • $begingroup$
                                Fails for 11th,12th,13th of each month
                                $endgroup$
                                – Expired Data
                                12 hours ago






                              • 1




                                $begingroup$
                                @ExpiredData Thanks for reporting this. Fixed now.
                                $endgroup$
                                – Arnauld
                                11 hours ago










                              • $begingroup$
                                Ignore my comment, I made an ID10T error.
                                $endgroup$
                                – asgallant
                                6 hours ago










                              • $begingroup$
                                I'm not sure how nodejs handle language tags, but it seems using 0 would work as using "en". And changing to toLocaleString would save 4 bytes. 110 bytes
                                $endgroup$
                                – tsh
                                1 hour ago
















                              $begingroup$
                              Fails for 11th,12th,13th of each month
                              $endgroup$
                              – Expired Data
                              12 hours ago




                              $begingroup$
                              Fails for 11th,12th,13th of each month
                              $endgroup$
                              – Expired Data
                              12 hours ago




                              1




                              1




                              $begingroup$
                              @ExpiredData Thanks for reporting this. Fixed now.
                              $endgroup$
                              – Arnauld
                              11 hours ago




                              $begingroup$
                              @ExpiredData Thanks for reporting this. Fixed now.
                              $endgroup$
                              – Arnauld
                              11 hours ago












                              $begingroup$
                              Ignore my comment, I made an ID10T error.
                              $endgroup$
                              – asgallant
                              6 hours ago




                              $begingroup$
                              Ignore my comment, I made an ID10T error.
                              $endgroup$
                              – asgallant
                              6 hours ago












                              $begingroup$
                              I'm not sure how nodejs handle language tags, but it seems using 0 would work as using "en". And changing to toLocaleString would save 4 bytes. 110 bytes
                              $endgroup$
                              – tsh
                              1 hour ago




                              $begingroup$
                              I'm not sure how nodejs handle language tags, but it seems using 0 would work as using "en". And changing to toLocaleString would save 4 bytes. 110 bytes
                              $endgroup$
                              – tsh
                              1 hour ago











                              1












                              $begingroup$


                              R, 158 134 bytes



                              -24 bytes @Nick Kennedy for golfing the 'st', 'nd', 'rd', & 'th'. Thanks!





                              f=format;paste0(a<-as.double(f(d<-as.Date(scan(,''),'%j'),'%e')),`if`((a-1)%%10>2|a%/%10==1,'th',c("st","nd","rd")[a%%10]),f(d,' %B'))


                              Try it online!






                              share|improve this answer











                              $endgroup$













                              • $begingroup$
                                How about tio.run/##HYxBCsIwEEWvIoEwMzDVRldi40K8hQgdmwQV20oSd949xm4e/… for 134 bytes
                                $endgroup$
                                – Nick Kennedy
                                9 hours ago










                              • $begingroup$
                                Yes, I need to learn `if` better. Thanks.
                                $endgroup$
                                – CT Hall
                                7 hours ago


















                              1












                              $begingroup$


                              R, 158 134 bytes



                              -24 bytes @Nick Kennedy for golfing the 'st', 'nd', 'rd', & 'th'. Thanks!





                              f=format;paste0(a<-as.double(f(d<-as.Date(scan(,''),'%j'),'%e')),`if`((a-1)%%10>2|a%/%10==1,'th',c("st","nd","rd")[a%%10]),f(d,' %B'))


                              Try it online!






                              share|improve this answer











                              $endgroup$













                              • $begingroup$
                                How about tio.run/##HYxBCsIwEEWvIoEwMzDVRldi40K8hQgdmwQV20oSd949xm4e/… for 134 bytes
                                $endgroup$
                                – Nick Kennedy
                                9 hours ago










                              • $begingroup$
                                Yes, I need to learn `if` better. Thanks.
                                $endgroup$
                                – CT Hall
                                7 hours ago
















                              1












                              1








                              1





                              $begingroup$


                              R, 158 134 bytes



                              -24 bytes @Nick Kennedy for golfing the 'st', 'nd', 'rd', & 'th'. Thanks!





                              f=format;paste0(a<-as.double(f(d<-as.Date(scan(,''),'%j'),'%e')),`if`((a-1)%%10>2|a%/%10==1,'th',c("st","nd","rd")[a%%10]),f(d,' %B'))


                              Try it online!






                              share|improve this answer











                              $endgroup$




                              R, 158 134 bytes



                              -24 bytes @Nick Kennedy for golfing the 'st', 'nd', 'rd', & 'th'. Thanks!





                              f=format;paste0(a<-as.double(f(d<-as.Date(scan(,''),'%j'),'%e')),`if`((a-1)%%10>2|a%/%10==1,'th',c("st","nd","rd")[a%%10]),f(d,' %B'))


                              Try it online!







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited 7 hours ago

























                              answered 11 hours ago









                              CT HallCT Hall

                              3519




                              3519












                              • $begingroup$
                                How about tio.run/##HYxBCsIwEEWvIoEwMzDVRldi40K8hQgdmwQV20oSd949xm4e/… for 134 bytes
                                $endgroup$
                                – Nick Kennedy
                                9 hours ago










                              • $begingroup$
                                Yes, I need to learn `if` better. Thanks.
                                $endgroup$
                                – CT Hall
                                7 hours ago




















                              • $begingroup$
                                How about tio.run/##HYxBCsIwEEWvIoEwMzDVRldi40K8hQgdmwQV20oSd949xm4e/… for 134 bytes
                                $endgroup$
                                – Nick Kennedy
                                9 hours ago










                              • $begingroup$
                                Yes, I need to learn `if` better. Thanks.
                                $endgroup$
                                – CT Hall
                                7 hours ago


















                              $begingroup$
                              How about tio.run/##HYxBCsIwEEWvIoEwMzDVRldi40K8hQgdmwQV20oSd949xm4e/… for 134 bytes
                              $endgroup$
                              – Nick Kennedy
                              9 hours ago




                              $begingroup$
                              How about tio.run/##HYxBCsIwEEWvIoEwMzDVRldi40K8hQgdmwQV20oSd949xm4e/… for 134 bytes
                              $endgroup$
                              – Nick Kennedy
                              9 hours ago












                              $begingroup$
                              Yes, I need to learn `if` better. Thanks.
                              $endgroup$
                              – CT Hall
                              7 hours ago






                              $begingroup$
                              Yes, I need to learn `if` better. Thanks.
                              $endgroup$
                              – CT Hall
                              7 hours ago













                              1












                              $begingroup$

                              Shell + coreutils, 112 bytes





                              date -d1969-12-31 $1days +%-dth %B|sed -e s/1th/1st/ -e s/2th/2nd/ -e s/3th/3rd/ -e 's/(1.).. /1th /'


                              Try it online! Explanation:



                              date -d1969-12-31 $1days


                              Calculate the number of days after the first day preceding a non-leap year. (Sadly you can't do relative date calculations from @-1.)



                              +%-dth %B|sed


                              Output the day of month (without leading zero), th, and the full month name.



                              -e s/1th/1st/ -e s/2th/2nd/ -e s/3th/3rd/


                              Fix up 1st, 2nd, 3rd, 21st, 22nd, 23rd and 31st.



                              -e 's/(1.).. /1th /'


                              Restore 11th to 13th.






                              share|improve this answer









                              $endgroup$


















                                1












                                $begingroup$

                                Shell + coreutils, 112 bytes





                                date -d1969-12-31 $1days +%-dth %B|sed -e s/1th/1st/ -e s/2th/2nd/ -e s/3th/3rd/ -e 's/(1.).. /1th /'


                                Try it online! Explanation:



                                date -d1969-12-31 $1days


                                Calculate the number of days after the first day preceding a non-leap year. (Sadly you can't do relative date calculations from @-1.)



                                +%-dth %B|sed


                                Output the day of month (without leading zero), th, and the full month name.



                                -e s/1th/1st/ -e s/2th/2nd/ -e s/3th/3rd/


                                Fix up 1st, 2nd, 3rd, 21st, 22nd, 23rd and 31st.



                                -e 's/(1.).. /1th /'


                                Restore 11th to 13th.






                                share|improve this answer









                                $endgroup$
















                                  1












                                  1








                                  1





                                  $begingroup$

                                  Shell + coreutils, 112 bytes





                                  date -d1969-12-31 $1days +%-dth %B|sed -e s/1th/1st/ -e s/2th/2nd/ -e s/3th/3rd/ -e 's/(1.).. /1th /'


                                  Try it online! Explanation:



                                  date -d1969-12-31 $1days


                                  Calculate the number of days after the first day preceding a non-leap year. (Sadly you can't do relative date calculations from @-1.)



                                  +%-dth %B|sed


                                  Output the day of month (without leading zero), th, and the full month name.



                                  -e s/1th/1st/ -e s/2th/2nd/ -e s/3th/3rd/


                                  Fix up 1st, 2nd, 3rd, 21st, 22nd, 23rd and 31st.



                                  -e 's/(1.).. /1th /'


                                  Restore 11th to 13th.






                                  share|improve this answer









                                  $endgroup$



                                  Shell + coreutils, 112 bytes





                                  date -d1969-12-31 $1days +%-dth %B|sed -e s/1th/1st/ -e s/2th/2nd/ -e s/3th/3rd/ -e 's/(1.).. /1th /'


                                  Try it online! Explanation:



                                  date -d1969-12-31 $1days


                                  Calculate the number of days after the first day preceding a non-leap year. (Sadly you can't do relative date calculations from @-1.)



                                  +%-dth %B|sed


                                  Output the day of month (without leading zero), th, and the full month name.



                                  -e s/1th/1st/ -e s/2th/2nd/ -e s/3th/3rd/


                                  Fix up 1st, 2nd, 3rd, 21st, 22nd, 23rd and 31st.



                                  -e 's/(1.).. /1th /'


                                  Restore 11th to 13th.







                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  answered 4 hours ago









                                  NeilNeil

                                  81.6k745178




                                  81.6k745178























                                      0












                                      $begingroup$


                                      C# (Visual C# Interactive Compiler), 141 139 133 124 122 bytes





                                      a=>{var d=s.AddDays(a-1);int x=d.Day,m=x%30%20;return x+"thstndrd".Substring(m<4?m*2:0,2)+d.ToString(" MMMM");};DateTime s


                                      Thanks to Arnauld for faster method of removing 11,12,13th saving 4 bytes



                                      Try it online!






                                      share|improve this answer










                                      New contributor




                                      Expired Data is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.






                                      $endgroup$













                                      • $begingroup$
                                        Using C# 8, this can be reduced to: a=>{var d=s.AddDays(a-1);int x=d.Day,m=x%30%20;return x+"thstndrd"[(m<4?m*2:0)..2]+$" {d:MMMM}";};DateTime s The interactive compiler doesn't seem to support changing its language level to "preview" at this time, though.
                                        $endgroup$
                                        – briman0094
                                        9 hours ago












                                      • $begingroup$
                                        116 bytes
                                        $endgroup$
                                        – Embodiment of Ignorance
                                        8 hours ago










                                      • $begingroup$
                                        I'm pretty sure you have to add a semi-colon after the DataTime s
                                        $endgroup$
                                        – Embodiment of Ignorance
                                        2 hours ago
















                                      0












                                      $begingroup$


                                      C# (Visual C# Interactive Compiler), 141 139 133 124 122 bytes





                                      a=>{var d=s.AddDays(a-1);int x=d.Day,m=x%30%20;return x+"thstndrd".Substring(m<4?m*2:0,2)+d.ToString(" MMMM");};DateTime s


                                      Thanks to Arnauld for faster method of removing 11,12,13th saving 4 bytes



                                      Try it online!






                                      share|improve this answer










                                      New contributor




                                      Expired Data is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.






                                      $endgroup$













                                      • $begingroup$
                                        Using C# 8, this can be reduced to: a=>{var d=s.AddDays(a-1);int x=d.Day,m=x%30%20;return x+"thstndrd"[(m<4?m*2:0)..2]+$" {d:MMMM}";};DateTime s The interactive compiler doesn't seem to support changing its language level to "preview" at this time, though.
                                        $endgroup$
                                        – briman0094
                                        9 hours ago












                                      • $begingroup$
                                        116 bytes
                                        $endgroup$
                                        – Embodiment of Ignorance
                                        8 hours ago










                                      • $begingroup$
                                        I'm pretty sure you have to add a semi-colon after the DataTime s
                                        $endgroup$
                                        – Embodiment of Ignorance
                                        2 hours ago














                                      0












                                      0








                                      0





                                      $begingroup$


                                      C# (Visual C# Interactive Compiler), 141 139 133 124 122 bytes





                                      a=>{var d=s.AddDays(a-1);int x=d.Day,m=x%30%20;return x+"thstndrd".Substring(m<4?m*2:0,2)+d.ToString(" MMMM");};DateTime s


                                      Thanks to Arnauld for faster method of removing 11,12,13th saving 4 bytes



                                      Try it online!






                                      share|improve this answer










                                      New contributor




                                      Expired Data is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.






                                      $endgroup$




                                      C# (Visual C# Interactive Compiler), 141 139 133 124 122 bytes





                                      a=>{var d=s.AddDays(a-1);int x=d.Day,m=x%30%20;return x+"thstndrd".Substring(m<4?m*2:0,2)+d.ToString(" MMMM");};DateTime s


                                      Thanks to Arnauld for faster method of removing 11,12,13th saving 4 bytes



                                      Try it online!







                                      share|improve this answer










                                      New contributor




                                      Expired Data is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.









                                      share|improve this answer



                                      share|improve this answer








                                      edited 10 hours ago





















                                      New contributor




                                      Expired Data is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.









                                      answered 12 hours ago









                                      Expired DataExpired Data

                                      1213




                                      1213




                                      New contributor




                                      Expired Data is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.





                                      New contributor





                                      Expired Data is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.






                                      Expired Data is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.












                                      • $begingroup$
                                        Using C# 8, this can be reduced to: a=>{var d=s.AddDays(a-1);int x=d.Day,m=x%30%20;return x+"thstndrd"[(m<4?m*2:0)..2]+$" {d:MMMM}";};DateTime s The interactive compiler doesn't seem to support changing its language level to "preview" at this time, though.
                                        $endgroup$
                                        – briman0094
                                        9 hours ago












                                      • $begingroup$
                                        116 bytes
                                        $endgroup$
                                        – Embodiment of Ignorance
                                        8 hours ago










                                      • $begingroup$
                                        I'm pretty sure you have to add a semi-colon after the DataTime s
                                        $endgroup$
                                        – Embodiment of Ignorance
                                        2 hours ago


















                                      • $begingroup$
                                        Using C# 8, this can be reduced to: a=>{var d=s.AddDays(a-1);int x=d.Day,m=x%30%20;return x+"thstndrd"[(m<4?m*2:0)..2]+$" {d:MMMM}";};DateTime s The interactive compiler doesn't seem to support changing its language level to "preview" at this time, though.
                                        $endgroup$
                                        – briman0094
                                        9 hours ago












                                      • $begingroup$
                                        116 bytes
                                        $endgroup$
                                        – Embodiment of Ignorance
                                        8 hours ago










                                      • $begingroup$
                                        I'm pretty sure you have to add a semi-colon after the DataTime s
                                        $endgroup$
                                        – Embodiment of Ignorance
                                        2 hours ago
















                                      $begingroup$
                                      Using C# 8, this can be reduced to: a=>{var d=s.AddDays(a-1);int x=d.Day,m=x%30%20;return x+"thstndrd"[(m<4?m*2:0)..2]+$" {d:MMMM}";};DateTime s The interactive compiler doesn't seem to support changing its language level to "preview" at this time, though.
                                      $endgroup$
                                      – briman0094
                                      9 hours ago






                                      $begingroup$
                                      Using C# 8, this can be reduced to: a=>{var d=s.AddDays(a-1);int x=d.Day,m=x%30%20;return x+"thstndrd"[(m<4?m*2:0)..2]+$" {d:MMMM}";};DateTime s The interactive compiler doesn't seem to support changing its language level to "preview" at this time, though.
                                      $endgroup$
                                      – briman0094
                                      9 hours ago














                                      $begingroup$
                                      116 bytes
                                      $endgroup$
                                      – Embodiment of Ignorance
                                      8 hours ago




                                      $begingroup$
                                      116 bytes
                                      $endgroup$
                                      – Embodiment of Ignorance
                                      8 hours ago












                                      $begingroup$
                                      I'm pretty sure you have to add a semi-colon after the DataTime s
                                      $endgroup$
                                      – Embodiment of Ignorance
                                      2 hours ago




                                      $begingroup$
                                      I'm pretty sure you have to add a semi-colon after the DataTime s
                                      $endgroup$
                                      – Embodiment of Ignorance
                                      2 hours ago











                                      0












                                      $begingroup$


                                      C# (Visual C# Interactive Compiler), 115 bytes





                                      n=>{var g=p.AddDays(n-1);int f=g.Day,m=f%20%30<4?f%10:0;return f+$"{"tsnr"[m]+""+"htdd"[m]} {g:MMMM}";};DateTime p;


                                      Try it online!






                                      share|improve this answer











                                      $endgroup$


















                                        0












                                        $begingroup$


                                        C# (Visual C# Interactive Compiler), 115 bytes





                                        n=>{var g=p.AddDays(n-1);int f=g.Day,m=f%20%30<4?f%10:0;return f+$"{"tsnr"[m]+""+"htdd"[m]} {g:MMMM}";};DateTime p;


                                        Try it online!






                                        share|improve this answer











                                        $endgroup$
















                                          0












                                          0








                                          0





                                          $begingroup$


                                          C# (Visual C# Interactive Compiler), 115 bytes





                                          n=>{var g=p.AddDays(n-1);int f=g.Day,m=f%20%30<4?f%10:0;return f+$"{"tsnr"[m]+""+"htdd"[m]} {g:MMMM}";};DateTime p;


                                          Try it online!






                                          share|improve this answer











                                          $endgroup$




                                          C# (Visual C# Interactive Compiler), 115 bytes





                                          n=>{var g=p.AddDays(n-1);int f=g.Day,m=f%20%30<4?f%10:0;return f+$"{"tsnr"[m]+""+"htdd"[m]} {g:MMMM}";};DateTime p;


                                          Try it online!







                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited 8 hours ago

























                                          answered 8 hours ago









                                          Embodiment of IgnoranceEmbodiment of Ignorance

                                          1,688124




                                          1,688124























                                              0












                                              $begingroup$


                                              Jelly, 115 114 bytes



                                              ’%⁵<3a:⁵n1Ɗ×%⁵$Ḥ+ؽị“thstndrd”ṭ
                                              “5<Ḟ’b4+28ÄŻ_@µ>0T,>0$ƇZṪµ1ịị“1;8-UÞẆĊƬṁɱkzIṇkµ⁴ JḷJdɱ<©Q£Ƈ.dẊṘh!İḞẠƒĊ¶÷»Ỵ¤,2ịÇƊṚK


                                              Try it online!



                                              Long by Jelly standards, but done from first principles.






                                              share|improve this answer











                                              $endgroup$


















                                                0












                                                $begingroup$


                                                Jelly, 115 114 bytes



                                                ’%⁵<3a:⁵n1Ɗ×%⁵$Ḥ+ؽị“thstndrd”ṭ
                                                “5<Ḟ’b4+28ÄŻ_@µ>0T,>0$ƇZṪµ1ịị“1;8-UÞẆĊƬṁɱkzIṇkµ⁴ JḷJdɱ<©Q£Ƈ.dẊṘh!İḞẠƒĊ¶÷»Ỵ¤,2ịÇƊṚK


                                                Try it online!



                                                Long by Jelly standards, but done from first principles.






                                                share|improve this answer











                                                $endgroup$
















                                                  0












                                                  0








                                                  0





                                                  $begingroup$


                                                  Jelly, 115 114 bytes



                                                  ’%⁵<3a:⁵n1Ɗ×%⁵$Ḥ+ؽị“thstndrd”ṭ
                                                  “5<Ḟ’b4+28ÄŻ_@µ>0T,>0$ƇZṪµ1ịị“1;8-UÞẆĊƬṁɱkzIṇkµ⁴ JḷJdɱ<©Q£Ƈ.dẊṘh!İḞẠƒĊ¶÷»Ỵ¤,2ịÇƊṚK


                                                  Try it online!



                                                  Long by Jelly standards, but done from first principles.






                                                  share|improve this answer











                                                  $endgroup$




                                                  Jelly, 115 114 bytes



                                                  ’%⁵<3a:⁵n1Ɗ×%⁵$Ḥ+ؽị“thstndrd”ṭ
                                                  “5<Ḟ’b4+28ÄŻ_@µ>0T,>0$ƇZṪµ1ịị“1;8-UÞẆĊƬṁɱkzIṇkµ⁴ JḷJdɱ<©Q£Ƈ.dẊṘh!İḞẠƒĊ¶÷»Ỵ¤,2ịÇƊṚK


                                                  Try it online!



                                                  Long by Jelly standards, but done from first principles.







                                                  share|improve this answer














                                                  share|improve this answer



                                                  share|improve this answer








                                                  edited 5 hours ago

























                                                  answered 6 hours ago









                                                  Nick KennedyNick Kennedy

                                                  66137




                                                  66137























                                                      0












                                                      $begingroup$


                                                      Perl 6, 166 161 bytes





                                                      {~(.day~(<th st nd rd>[.day%30%20]||'th'),<January February March April May June July August September October November December>[.month-1])}o*+Date.new(1,1,1)-1


                                                      Try it online!



                                                      Hardcodes all the month names, which takes up most of the space. Man, Perl 6 really needs a proper date formatter.






                                                      share|improve this answer











                                                      $endgroup$













                                                      • $begingroup$
                                                        My previous answer did the same :-(
                                                        $endgroup$
                                                        – Ven
                                                        4 hours ago
















                                                      0












                                                      $begingroup$


                                                      Perl 6, 166 161 bytes





                                                      {~(.day~(<th st nd rd>[.day%30%20]||'th'),<January February March April May June July August September October November December>[.month-1])}o*+Date.new(1,1,1)-1


                                                      Try it online!



                                                      Hardcodes all the month names, which takes up most of the space. Man, Perl 6 really needs a proper date formatter.






                                                      share|improve this answer











                                                      $endgroup$













                                                      • $begingroup$
                                                        My previous answer did the same :-(
                                                        $endgroup$
                                                        – Ven
                                                        4 hours ago














                                                      0












                                                      0








                                                      0





                                                      $begingroup$


                                                      Perl 6, 166 161 bytes





                                                      {~(.day~(<th st nd rd>[.day%30%20]||'th'),<January February March April May June July August September October November December>[.month-1])}o*+Date.new(1,1,1)-1


                                                      Try it online!



                                                      Hardcodes all the month names, which takes up most of the space. Man, Perl 6 really needs a proper date formatter.






                                                      share|improve this answer











                                                      $endgroup$




                                                      Perl 6, 166 161 bytes





                                                      {~(.day~(<th st nd rd>[.day%30%20]||'th'),<January February March April May June July August September October November December>[.month-1])}o*+Date.new(1,1,1)-1


                                                      Try it online!



                                                      Hardcodes all the month names, which takes up most of the space. Man, Perl 6 really needs a proper date formatter.







                                                      share|improve this answer














                                                      share|improve this answer



                                                      share|improve this answer








                                                      edited 3 hours ago

























                                                      answered 6 hours ago









                                                      Jo KingJo King

                                                      24.8k358128




                                                      24.8k358128












                                                      • $begingroup$
                                                        My previous answer did the same :-(
                                                        $endgroup$
                                                        – Ven
                                                        4 hours ago


















                                                      • $begingroup$
                                                        My previous answer did the same :-(
                                                        $endgroup$
                                                        – Ven
                                                        4 hours ago
















                                                      $begingroup$
                                                      My previous answer did the same :-(
                                                      $endgroup$
                                                      – Ven
                                                      4 hours ago




                                                      $begingroup$
                                                      My previous answer did the same :-(
                                                      $endgroup$
                                                      – Ven
                                                      4 hours ago











                                                      0












                                                      $begingroup$

                                                      Smalltalk, 101 bytes



                                                      d:=Date year:1day:n.m:=d dayOfMonth.o:={#st.#nd.#rd}at:m\10ifAbsent:#th.m asString,o,' ',d monthName





                                                      share|improve this answer









                                                      $endgroup$


















                                                        0












                                                        $begingroup$

                                                        Smalltalk, 101 bytes



                                                        d:=Date year:1day:n.m:=d dayOfMonth.o:={#st.#nd.#rd}at:m\10ifAbsent:#th.m asString,o,' ',d monthName





                                                        share|improve this answer









                                                        $endgroup$
















                                                          0












                                                          0








                                                          0





                                                          $begingroup$

                                                          Smalltalk, 101 bytes



                                                          d:=Date year:1day:n.m:=d dayOfMonth.o:={#st.#nd.#rd}at:m\10ifAbsent:#th.m asString,o,' ',d monthName





                                                          share|improve this answer









                                                          $endgroup$



                                                          Smalltalk, 101 bytes



                                                          d:=Date year:1day:n.m:=d dayOfMonth.o:={#st.#nd.#rd}at:m\10ifAbsent:#th.m asString,o,' ',d monthName






                                                          share|improve this answer












                                                          share|improve this answer



                                                          share|improve this answer










                                                          answered 2 hours ago









                                                          Leandro CanigliaLeandro Caniglia

                                                          1313




                                                          1313






























                                                              draft saved

                                                              draft discarded




















































                                                              If this is an answer to a challenge…




                                                              • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                              • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                Explanations of your answer make it more interesting to read and are very much encouraged.


                                                              • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                                              More generally…




                                                              • …Please make sure to answer the question and provide sufficient detail.


                                                              • …Avoid asking for help, clarification or responding to other answers (use comments instead).





                                                              draft saved


                                                              draft discarded














                                                              StackExchange.ready(
                                                              function () {
                                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f181468%2fits-a-yearly-task-alright%23new-answer', 'question_page');
                                                              }
                                                              );

                                                              Post as a guest















                                                              Required, but never shown





















































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown

































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown







                                                              Popular posts from this blog

                                                              If I really need a card on my start hand, how many mulligans make sense? [duplicate]

                                                              Alcedinidae

                                                              Can an atomic nucleus contain both particles and antiparticles? [duplicate]