# Print all Sundays in 2017

Print the dates of all the Sundays in 2017 in the following format : dd.mm.yyyy.
Expected Output:

01.01.2017
08.01.2017
15.01.2017
22.01.2017
29.01.2017
05.02.2017
12.02.2017
19.02.2017
26.02.2017
05.03.2017
12.03.2017
19.03.2017
26.03.2017
02.04.2017
09.04.2017
16.04.2017
23.04.2017
30.04.2017
07.05.2017
14.05.2017
21.05.2017
28.05.2017
04.06.2017
11.06.2017
18.06.2017
25.06.2017
02.07.2017
09.07.2017
16.07.2017
23.07.2017
30.07.2017
06.08.2017
13.08.2017
20.08.2017
27.08.2017
03.09.2017
10.09.2017
17.09.2017
24.09.2017
01.10.2017
08.10.2017
15.10.2017
22.10.2017
29.10.2017
05.11.2017
12.11.2017
19.11.2017
26.11.2017
03.12.2017
10.12.2017
17.12.2017
24.12.2017
31.12.2017
• Possible dupe of Plan your Sundays? This one is a specific year though. – xnor Apr 13 '17 at 3:19
• I checked out Plan your Sundays before posting, but it asks to print the Sundays in a given month. @xnor – ShinMigami13 Apr 13 '17 at 3:21
• Any particular reason for that specific output format? You could open in up a bit. – Rɪᴋᴇʀ Apr 13 '17 at 3:22
• I actually like this as an exact-text kolmogorov challenge. Getting the date formatting right has some interesting optimizations. – xnor Apr 13 '17 at 3:23
• Anyways, I think the close votes should be retracted. – Erik the Outgolfer Apr 13 '17 at 8:28

# Python 2, 81 bytes

x=0
exec"print'%05.2f.2017'%(x%30.99+1.01);x+=7+'0009ANW'.count(chr(x/7+40));"*53

Try it online!

No date libraries, computes the dates directly. The main trick is to treat the dd.mm as a decimal value. For example, 16.04.2017 (April 16) corresponds to the number 16.04. The number is printed formatted as xx.xx with .2017 appended.

The day and month are computed arithmetically. Each week adds 7 days done as x+=7. Taking x modulo 30.99 handles rollover by subtracting 30.99 whenever the day number gets too big. This combines -31 to reset the days with +0.01 to increment the month.

The rollover assumes each month has 31 days. Months with fewer days are adjusted for by nudging x upwards on certain week numbers with +[8,8,8,17,25,38,47].count(x/7). These list is of the week numbers ending these short months, with 8 tripled because February is 3 days short of 31.

This list could is compressed into a string by taking ASCII values plus 40. The shift of +40 could be avoided by using unprintable chars, and could be accessed shorter as a bytes object in Python 3.

• What a cool answer! '888z!}+'.count(chr(x%146)) saves one byte. – Lynn May 11 '18 at 7:51

# PHP, 48 bytes

while($t<53)echo gmdate("d.m.2017 ",605e3*$t++);

### PHP, 46 bytes (for non-negative UTC offsets)

while($t<53)echo date("d.m.2017 ",605e3*$t++);
• Shouldn´t that be gmdate for timezone safety? It fails on onlinephpfunctions.com. Great work in all other aspects! – Titus Apr 14 '17 at 17:42

# Python 2, 90 79 bytes

-5 bytes with the help of xnor (avoid counting the weeks themselves)
-1 byte thanks to xnor (add back in e for 605000 as 605e3)

from time import*
i=0
exec"print strftime('%d.%m.2017',gmtime(i));i+=605e3;"*53

Try it online!

0 seconds since epoch is 00:00:00 on the 1st of January 1970, which, like 2017 was not a leap year. 605000 seconds is 1 week, 3 minutes, 20 seconds. Adding 52 of these "weeks" does not take us beyond midnight.

• Here's a shorter way to generate the arithmetic progression. – xnor Apr 13 '17 at 5:37
• @xnor Thanks, I was working on the same kind of thing and was trying to go lower, but 81 seems to much to go for with the library approach. – Jonathan Allan Apr 13 '17 at 6:00
• @xnor ...or not. – Jonathan Allan Apr 13 '17 at 6:21
• Nice! The number can be 605e3. I have some ideas though :) – xnor Apr 13 '17 at 6:23

# Bash + coreutils, 44 bytes

seq -f@%f 0 605e3 32e6|date -uf- +%d.%m.2017

may save 2 bytes -u if GMT is assumed

• Thanks Digital Trauma point out -f paramter for date which saves 10 bytes;
• And use 2017 in format string saves more bytes which idea is from the answer given by user63956

• @0 is 1970-1-1
• 605000 is one week (604800) plus 200 sec
• 200 sec. should just work since there are only 52 weeks in a year
• @32000000 is just a little more than a year

# PowerShell, 51 47

0..52|%{date((date 2017-1-1)+7.*$_)-u %d.%m.%Y} Fairly straightforward. 2017-01-01 is a Sunday, so is every following seven days. We can save two bytes if we only need the script to be working in my lifetime: 0..52|%{date((date 17-1-1)+7.*$_)-u %d.%m.%Y}
• You can save a few bytes if you, instead of a string, add a double representing number of days, i.e. (date 2017-1-1)+7.*$_ . See this answer – Danko Durbić Apr 13 '17 at 14:00 • @DankoDurbić: Oh, wow. I only knew of adding int for ticks and strings for days so far. Nice to know. – Joey Apr 13 '17 at 18:18 Excel VBA 106 91 79 bytes Sub p() For i = #1/1/2017# To #12/31/2017# If Weekday(i) = 1 Then MsgBox i Next End Sub saved 15 bytes thanks to @Radhato Assuming 1/1/2017 is Sunday it will save 12 more bytes. Sub p() For i = #1/1/2017# To #12/31/2017# MsgBox i i = i + 6 Next End Sub Thanks @Toothbrush 66 bytes Sub p:For i=#1/1/2017# To #12/31/2017#:MsgBox i:i=i+6:Next:End Sub Edit: (Sub and End Sub is not necessary) 52 bytes For i=#1/1/2017# To #12/31/2017#:MsgBox i:i=i+6:Next • Can be improved by chanching For i = 42736 To 43100 to For i = #1/1/2017# To #12/31/2017# and then removing Format(...) replacing with just i – Radhato Apr 13 '17 at 6:43 • @Radhato but wouldn't that increase byte size? – Prison Mike Apr 13 '17 at 6:44 • I think it reduces it to 96.. at least thats what I counted lol – Radhato Apr 13 '17 at 6:48 • Yes it did. Thanks – Prison Mike Apr 13 '17 at 6:48 • @newguy Sub p:For i=#1/1/2017# To #12/31/2017#:MsgBox i:i=i+6:Next:End Sub is perfectly valid VBA code and is only 66 bytes. The fact that the VBA Editor adds in extra spaces is irrelevant. – Toothbrush Apr 13 '17 at 20:39 # PHP, 67 bytes Using the fact the PHP automatically assign value 1 to undeclared loop variables, and using Linux epoch times, <?php for(;54>$t+=1;)echo date("d.m.Y\n",604800*($t)+1482624000);?> • Welcome to PPCG! I believe this can be counted as 59 bytes (although I don't golf in PHP myself). – Jonathan Allan Apr 13 '17 at 5:04 • <?for(;54>++$t;)echo date("d.m.Y\n",605e3*$t+148263e4); should just be ok – tsh Apr 13 '17 at 6:03 • Always nice to see some new PHP golfers ! You're allowed to use php -r so you don't need <?php and ?> and therefore can count this as 59 bytes like @JonathanAllan correctly said. You don't need the brackets around$t. A few other golfs and you end up with for(;++$t<54;)echo date("d.m.Y\n",605e3*$t+14827e5); for 51 bytes (in my time zone). You can replace "\n" with a real line break which is only 1 byte therefore it's 51 byte. – Christoph Apr 13 '17 at 12:05
• Thanks @Christoph I'm trying out another approach, will update soon – ShinMigami13 Apr 13 '17 at 15:55
• Apart from all the other hints, you might want to use gmdate instead of date for timezone safety. – Titus Apr 14 '17 at 17:47

# k6, 32 bytes

0:("."/|"."\)'$2017.01.01+7*!53 Brief explanation: 2017.01.01+7*!53 /add 0, 7, 14, ..., 364 to January 1st ("."/|"."\)'$                 /convert to string, turn Y.m.d into d.m.Y
/   split by ".", reverse, join by "."
0:                              /output to stdout (or stderr), line by line

Alas, this seems to only work in the closed-source, on-request-only interpreter.

# Pyke, 26 24 bytes

53 Fy17y"RVs6)c"%d.%m.%Y

Try it online!

53 F                     - for i in range(53):, printing a newline between each
y17y"                -  Create a time object with the year 2017. (Month and days are initialised to 1.)
RV  )           -  Repeat i times:
c"%d.%m.%Y -  Format in "dd.mm.yyyy" time

### Or 11 bytes

If allowed to ignore output format

y17y"52VDs6

Try it online!

y17y"       - Create a time object with the year 2017. (Month and days are initialised to 1.)
52V    - Repeat 52 times:
D   -  Duplicate the old time

## R, 7967 58 bytes

cat(format(seq(as.Date("2017/01/01"),,7,53),"\n%d.%m.%Y"))

First of January being a sunday, this snippet creates a sequence of days, every 7 days starting from the 01-01-2017 to the 31-12-2017, format them to the desired format and print them.

• This should bring it down to 41 bytes print(as.Date("2017-01-01")+seq(7,365,7)) – count Apr 22 '17 at 22:17
• @count Thanks but it wouldn't print the required output (i. e. "2017.01.01" instead of "2017/01/01") – plannapus Apr 23 '17 at 5:43

# Befunge-98 (PyFunge), 999593 85 bytes, Leaves trailing newline

All the optimizations were made by @JoKing many thanks to them

s :1g2/10g\%:d1p10g\+:b#@_:1\0d1g#;1+:a/'0+,a%'0+,'.,j;a"7102"4k,d1g7+
>8><><>><><>

Try it online!

I felt like we were missing out on some esostericity here so I made a solution in my favourite Esosteric language.

Explanation:
>8><><>><><> Encodes the length of the 12 months
s Store the old day in the blank space
:1g2/ Get an ASCII value from the bottom row and divide it by two this gives us the length of a given month Ex: 8 = 56 in ASCII => 56/2 = 28 => The month (February) has 28 days
10g\% Get the previously saved day and modulo it by the length of the month which allows us to transition the date into the next month
:d1p Save a copy of the new updated day
10g\+ Test if old date > new date => we transitioned into the next month => add 1 to the month counter
:b Test if month counter > 11 that means we reached the end of the year (using 0 indexing)
#@_ Based on the previous if terminate the program
:1\0d1g Reorder the stack so it looks like this: Month, 1, Month, 0, Day
# skip the next insctruction (duh)
1+:a/'0+,a%'0+,'., Convert the number to 1 indexing, print, add a . at the end
j; Use the 0 from the stack to not jump and use the ; to go to to the print schedule again then use the 1 to jump over the ; next time
a"7102"4k, Print 2017\n
d1g Get the day value again 7+ Add a week before repeating

• @JoKing Omc such an obvious optimization! How could've I missed that one? Thank you. – IQuick 143 May 12 '18 at 11:51
• A few more bytes off. Try it online! One from changing the -17 jump to a comment instead, one from using 0 based indexing for the month counter and one from changing it to a one-liner – Jo King May 12 '18 at 12:54
• @JoKing Wow that's a lot of golfing you did there. Lemme add it to the answer. – IQuick 143 May 12 '18 at 12:58
• Hell, why not make the days 0 indexed as well, and save having to do any of the initialisation at all! 85 bytes – Jo King May 12 '18 at 13:38

## JavaScript, 111 106 bytes

for(i=14833e8;i<1515e9;i+=605e6)console.log(new Date(i).toJSON().replace(/(....).(..).(..).*/,'$3.$2.$1')) Note: Stack Exchange's console isn't long enough to display the entire list, so here's the first half as a separate snippet: for(i=14833e8;i<15e11;i+=605e6)console.log(new Date(i).toJSON().replace(/(....).(..).(..).*/,'$3.$2.$1'))

The custom format costs me 40 bytes...

# Perl 5, 64 bytes

use POSIX;print strftime"%d.%m.%Y\n",0,0,0,7*$_+1,0,117for 0..52 Try it online! The task given was 2017, not any year, so I hardcoded in: • 117 (which is perlish for year 2017, 1900+117) • +1 because 1st of January is a sunday in 2017 • 0..52 because 2017 have 53 sundays POSIX is a core module and is always installed with Perl5. Doing the same without using modules in 101 bytes, removing whitespace: $$_[5]==117&&printf"%02d.%02d.%d\n",$$_[3],$$_[4]+1,$$_[5]+1900 for map[gmtime(($_*7+3)*86400)],0..1e4

# Ruby, 75 bytes

Straightforward solution to figure out the dates with Time.

t=Time.new 2017
365.times{puts t.strftime("%d.%m.%Y")if t.sunday?
t+=86400}
• If you add a whole week(604800 seconds), then you don't need to check for a sunday, just repeat 53 times. – G B Apr 13 '17 at 13:38
• If you do the trick suggested by @GB and no longer check for Sunday, you can also initialize with t=Time.new 1 and then do t.strftime"%d.%m.2017" for -1 byte. – Value Ink Apr 13 '17 at 22:01

## SAS, 52 50 bytes

Saved 2 bytes thanks to @user3490.

data;do i=20820to 21184 by 7;put i ddmmyyp10.;end;
• You don't need to specify a dataset - just use data; instead of data c; and that saves 2 bytes. I think you do need a run; though. – user3490 Apr 13 '17 at 15:31
• @user3490 Thanks, I wasn't aware of that. I guess that's the equivalent of data _null_? Also, the run statement is implied if it's missing. – J_Lard Apr 13 '17 at 16:33
• Not quite equivalent - you end up with an output dataset following the datan naming convention. – user3490 Apr 18 '17 at 22:17

# Mathematica 90 84 bytes

Fairly wordy. numbermaniac and Scott Milner saved 5 and 1 bytes, respectively.

Column[#~DateString~{"Day",".","Month",".","Year"}&/@DayRange["2017","2018",Sunday]]
• Do you need the Most@? The output seems to be identical without it. – numbermaniac Apr 22 '17 at 11:51
• @numbermaniac, Thanks. Most was in there to avoid the first Sunday in 2018. I had originally tested the code, without Most, for years, 2011, 2012, in which case the first Sunday in 2012 is included in the output. (That's why I included it into the code.) Strangely, Most is not needed for 2017-18. Nor does Most have any apparent effect on the result. Mysterious! – DavidC Apr 22 '17 at 15:18

# VBA, 81 bytes (maybe 64)

Sub p()
For i = 0 To 52
MsgBox format(42736 + i * 7, "dd.mm.yyyy")
Next i
End Sub

My first post. Building on newguy's solution by removing the check for weekdays and just specifying every 7th day. Removing the dates saves 12 bytes a piece. 42736 is 1/1/2017. Output date format depends on system setting. Is that allowed? If so, it's 64 bytes because you don't need the format method.

MsgBox #1/1/2017# + i * 7
• You can also remove a lot of the white space that is autoformatted. For instance, and For i=0To 52 and Format(42736+i*7,"dd.mm.yyyy"). Also, you can just use Next instead of Next i. – Engineer Toast Apr 13 '17 at 12:33

# AHK, 67 bytes

d=20170101
Loop,52{
FormatTime,p,%d%,dd.MM.yyyy
Send,%p%n
d+=7,d
}

Nothing magical happens here. I tried to find a shorter means than FormatTime but I failed.

# Java 8+, 104100 99 bytes

()->{for(int t=0;t<53;)System.out.printf("%1$td.%1$tm.2017%n",new java.util.Date(t++*604800000L));}

# Java 5+, 109105 104 bytes

void f(){for(int t=0;t<53;)System.out.printf("%1$td.%1$tm.2017%n",new java.util.Date(t++*604800000L));}

Uses the date-capabilities of the printf format.

Test it yourself!

## Savings

1. 104 -> 100: changed the loop values and the multiplicand.
2. 100 -> 99: golfed the loop

# T-SQL, 94 Bytes

DECLARE @ INT=0,@_ DATETIME='2017'W:SET @+=1SET @_+=7PRINT FORMAT(@_,'dd.MM.yyy')IF @<52GOTO W

if you don't like SQL GOTO or WHILE, here is a 122 bytes CTE solution

WITH C AS(SELECT CAST('2017'AS DATETIME)x UNION ALL SELECT x+7FROM C WHERE X<'12-31-17')SELECT FORMAT(x,'dd.MM.yyy')FROM C
• your first solution starts at 08.01.2017 not 01.01.2017 – grabthefish Apr 14 '17 at 9:10
• Very good tricks in your solution. Good job. I couldn't resist to borrow them. ;) – AXMIM Apr 14 '17 at 16:11

# Ruby, 60+7 = 67 bytes

Uses the -rdate flag.

(d=Date.new 1).step(d+365,7){|d|puts d.strftime"%d.%m.2017"}

# Groovy, 81776360 56 bytes

d=new Date(0);53.times{printf('%td.%<tm.2017%n',d);d+=7}

The above can be run as groovy script.

My first code golf entry. Fortunately, the year 1970 was not a leap year, thus can use it as a base.

Thanks to Dennis, here's a: Try it online!

• Welcome to Programming Puzzles & Code Golf! In case you're interested, here's a permalink: Try it online! – Dennis Apr 14 '17 at 5:35
• Thank you @Dennis I didn't know this existed :) – Krystian Apr 14 '17 at 6:05
• You can save four bytes by moving the date inside the times block, 53.times{printf('%td.%<tm.2017%n',new Date(0)+it*7)}, 52 bytes. Defending groovy's honor here... – Matias Bjarland May 12 '18 at 10:36

# C#, 138111 102 bytes

Saved 9 more bytes thanks to Johan du Toit!

Saved 27 bytes thanks to Kevin Cruijssen's suggestions!

Anonymous function which prints all Sundays in 2017.

Full program with ungolfed method:

using System;

class P
{
static void Main()
{
Action f =
()=>
{
for (int i = 0; i < 53; )
Console.Write(new DateTime(2017, 1, 1).AddDays(7 * i++).ToString("dd.MM.yyyy\n"));
};

f();
}
}
• Isn't it easier to just use .AddDays(7*i++)? Then there is no need for the .DayOfWeek<1 check. We know 01-01-2017 is a Sunday, and from there we can just keep adding 7 days. – Kevin Cruijssen Apr 13 '17 at 13:04
• Not sure about this -- in all code golfs I partake, I always used the complete namespace -- but aren't you missing some Systems in there -- System.DateTime and System.Console.Write? – auhmaan Apr 13 '17 at 13:32
• Cool but you can save a couple of bytes: ()=>{for(int i=0;i<53;)Console.Write(new DateTime(2017,1,1).AddDays(7*i++).ToString("dd.MM.yyyy\n"));}; – Johan du Toit Apr 13 '17 at 20:39
• @auhmaan: Yes, either full namespaces should be used, or the using statements should be included in the byte count. – raznagul Apr 14 '17 at 8:14
• @adrianmp: Necessary using statements to run the code must be counted. See this Meta question: Do I need to use imports or can I call a class explicity? – raznagul Apr 14 '17 at 10:12

# C#, 110 109 bytes

In this soluion we :

FromOADate() seem big but it's equal to new DateTime(2017,1,1)

• Start the loop on the last sunday of 2016. to allow us to increment with operator += only. This operator return the value after the increment is done.

• Increment by 7 days to jump from sunday to sunday before printing the date.

• We stop once the last sunday of 2017 has been hit.

• Use Debug instead of Console to save two characters

• Avoid having explicit variable declaration and assignment

• Unless otherwise specified, our defaults say you should provide a function or program (i.e. not a snippet), and you need to qualify Debug and DateTime: I'd recommend adding using System; and switching to Console from Debug (which is a tad dodgy itself, but I can't find any commentary on meta regarding it). – VisualMelon Apr 14 '17 at 8:08
• @VisualMelon I've complied with "provide a function" and I have also replace Debug for Console since Debug required a specific include. However, I didn't comply with the 'use system' because my competitor in this language doesn't do it. Also, you can't code outside a class which itself required to be defined within a namespace. I'm pretty sure most c# answer on this site doesn't include that. So what now, do we throw all these answers to the garbage? Do we downvote them all to force them to comply? If so, then the community might as well ban c# from codegolf altogether. – AXMIM Apr 14 '17 at 14:20
• These 'rules' are just what the community has over time settled on (and documented on meta). We don't downvote answers, we comment and don't upvote them either. When they fix them, then we are free to upvote. Both other C# answers have comments suggesting they should add the using directive or fully qualify the methods and types, please don't take any of this personally. I'm a long time C# golfer, and I appreciate how arbitrary the rules seem, so I like to nudge people in the right direction when I can. I specifically 'target' C# answers because I'm relatively well informed on the matter. – VisualMelon Apr 14 '17 at 15:26
• @VisualMelon Fair enough, I'm just a passerby here anyway. So I shall accept your rules while I'm here. Therefore, I've attempted to make my answer comply this time. – AXMIM Apr 14 '17 at 17:13
• Looks good to me! +1 for the original approach. And you don't need the space after using System; (I assume that wasn't intentional) so that's 109 bytes. – VisualMelon Apr 14 '17 at 18:59

# TSQL, 112 105 bytes

SELECT CONVERT(VARCHAR,DATEADD(d,number*7,42734),104)FROM master..spt_values WHERE type='p' AND number<53

Demo

T-SQL Convert Syntax

• You can save 2 bytes by replacing DAY by d. It does the same. – AXMIM Apr 14 '17 at 14:53
• +1 You can save another 3 bytes by replacing '20170101' with 42734. Dates are number. Time is the decimals part of the number. – AXMIM Apr 14 '17 at 15:08

# JavaScript (ES6), 123 bytes

It's my first post here, hello!

a=x=>0${x}.`.slice(-3);[].map.call('155274263153',(x,i)=>{for(j=0;j<4+(2633>>i&1);j++)console.log(a(+x+j*7)+a(i+1)+2017)}) This solution uses hardcoded data and is designed to work specifically for the year 2017. It relies on no date/time APIs. As for the digits in the string 155274263153, each digit is a number of its own and denotes the first Sunday of each consecutive month. Output for the entire year can be generated by successively adding 7 to those. What about the magic number, 2633, used in the loop? Well... 2633 (decimal) is 101001001001 in binary. Now what could those 1s mean? Starting from the right, the 1st, 4th, 7th, 10th and 12th bit are set. This corresponds to months which happen to have five Sundays, as opposed to those that have only four. Golfed down to this neat expression, it initially looked like this: for(j=0;j<4+ +[0,3,6,9,11].includes(i);j++). I guess the remaining parts are fairly self-explanatory. • @SIGSEGV: I don't mind changing ECMAScript 2015 to Javascript (ES6), but... you broke my code and I had to revert it. – rhino Apr 15 '17 at 4:41 • Oh, that's the community's consensus, having only the lambda part is allowed. – Matthew Roh Apr 15 '17 at 4:45 • @SIGSEGV This is not the case here. This lambda contains only a small portion of the code, and I need that identifier to be able to use it elsewhere. Without the a= the code is actually broken. – rhino Apr 15 '17 at 4:51 # T-SQL, 79 77 Bytes After helping Salman A improve his answer. I decided to write my own using a loop and PRINT. I ended with this 90 bytes solution. DECLARE @d DATETIME=42734 WHILE @d<43100BEGIN PRINT CONVERT(VARCHAR,@d,104)SET @d=@d+7 END Then I looked at the current leader in T-SQL which was 94 bytes from WORNG ALL with this answer. This guy had found very good tricks. 1. Name the variable only @ 2. Loop with GOTO instead of actual LOOP 3. Save one character using FORMAT instead of CONVERT. (SSMS2012+ only) Using these tricks, this solution was trimmed down to the solution below which is 79 bytes. DECLARE @ DATETIME=42734G:PRINT FORMAT(@,'dd.MM.yyy')SET @+=7IF @<43100GOTO G • You can save 2 bytes by changing @=@+7 to @+=7 and by removing the space between the 7 and the IF. – WORNG ALL May 9 '17 at 20:42 • In this post is where I got all the tricks, may help you too. – WORNG ALL May 9 '17 at 20:43 • @WORNGALL wonderfull, I was unaware we could do that. Thanks a lot. – AXMIM May 10 '17 at 14:42 # Octave, 37 bytes A lot shorter than all other non-golfing languages, and it's even tied with Jelly! Way to go Octave! :) disp(datestr(367:7:737,'DD.mm.2017')) Try it online! Luckily, year 2 AD looks exactly the same as year 2017 AD. Both starts and ends at a Sunday, and neither is a leap year. This saves a lot of bytes, since 367:7:737 is quite a bit shorter than 736696:7:737060. This converts the number of days since 01.01.0001, to a string on the format DD.mm, with a trailing .2017. # Haskell, 133 130 bytes import Data.Time.Calendar ((\[f,g,h,i,j]->i:j:'.':f:g:".2017\n").drop 5.show)=<<take 53(iterate(addDays 7)$fromGregorian 2017 1 1)

Try it online!

### Without a calendar library, 148144 140 bytes

(\l->last l!l++length l!l++"2017\n").fst.span(>0).(<\$>scanl((+).(+28))0[3,0,3,2,3,2,3,3,2,3,2]).(-)=<<[1,8..365]
a!_=['0'|a<=9]++show a++"."

This is funny since using an operator for the padding function saves two bytes even though the second argument is unused, because less parentheses are needed – p(last l) is longer than last l!l. Works by calculating day/month pairs by subtracting the cumulative month start dates from the day of the year. The month start dates are compressed as (scanl((+).(+28))0[3,0,3,2,3,2,3,3,2,3,2]). Month number is the number of positive elements and day number is the last positive element.

Try it online!

## C#, 116114 113 bytes

for(long i=(long)636188256e9;i<636502857e9;i+=(long)605e10)Out.Write(‌​new DateTime(i).ToString("dd.MM.yyyy\n"));

Can be run in the interactive windows of Visual Studio (or any other C# REPL based on Roslyn)

Down to 113 bytes: thanks to Kevin Cruijssen.

• Could you add a TryItNow link? Also, you can golf it a bit by using a for-loop instead of a while-loop: for(long i=(long)636188256e9;i<636502857e9;i+=(long)605e10)Out.Write(new DateTime(i).ToString("dd.MM.yyyy\n")); – Kevin Cruijssen Apr 13 '17 at 11:57
• @KevinCruijssen Unfortunaly I am not able to find an applicable compiler on the given page. Here is a link to the used technology if you want to get in touch with it: link. Anyway thanks for the new loop. :) – rmrm Apr 13 '17 at 12:33
• Unless otherwise specified, our defaults say you should provide a function or program (i.e. not a snippet), and you need to qualify Debug and DateTime: I'd recommend adding using System; and using Console.WriteLine(string) – VisualMelon Apr 14 '17 at 8:11