Introduction

Some months are completely symmetric, meaning they have central symmetry as well as reflection symmetry, like February of 2010:

February 2010
┌──┬──┬──┬──┬──┬──┬──┐
│  │  │  │  │  │  │  │
├──┼──┼──┼──┼──┼──┼──┤
│  │  │  │  │  │  │  │
├──┼──┼──┼──┼──┼──┼──┤
│  │  │  │  │  │  │  │
├──┼──┼──┼──┼──┼──┼──┤
│  │  │  │  │  │  │  │
└──┴──┴──┴──┴──┴──┴──┘

Some months have only central symmetry, like February of 1996 or current month, the April of 2018:

February 1996
┌──┬──┬──┬──┐
│  │  │  │  │
┌──┬──┬──┼──┼──┼──┼──┤
│  │  │  │  │  │  │  │
├──┼──┼──┼──┼──┼──┼──┤
│  │  │  │  │  │  │  │
├──┼──┼──┼──┼──┼──┼──┤
│  │  │  │  │  │  │  │
├──┼──┼──┼──┼──┴──┴──┘
│  │  │  │  │
└──┴──┴──┴──┘

April 2018  ┌──┐
│  │
┌──┬──┬──┬──┬──┬──┼──┤
│  │  │  │  │  │  │  │
├──┼──┼──┼──┼──┼──┼──┤
│  │  │  │  │  │  │  │
├──┼──┼──┼──┼──┼──┼──┤
│  │  │  │  │  │  │  │
├──┼──┼──┼──┼──┼──┼──┤
│  │  │  │  │  │  │  │
├──┼──┴──┴──┴──┴──┴──┘
│  │
└──┘

And some are asymmetric, like the previous month, the March of 2018:

March 2018
┌──┬──┬──┬──┐
│  │  │  │  │
┌──┬──┬──┼──┼──┼──┼──┤
│  │  │  │  │  │  │  │
├──┼──┼──┼──┼──┼──┼──┤
│  │  │  │  │  │  │  │
├──┼──┼──┼──┼──┼──┼──┤
│  │  │  │  │  │  │  │
├──┼──┼──┼──┼──┼──┼──┘
│  │  │  │  │  │  │
└──┴──┴──┴──┴──┴──┘

Take an input in form of a date, e.g.:

• 2018.04
• 2018.03
• 2010.02
• 1996.02

Output the corresponding symmetry, e.g.

• 2018.04 -> centrally symmetric
• 2018.03 -> asymmetric
• 2010.02 -> symmetric
• 1996.02 -> centrally symmetric

Rules

• This is code golf, so the smallest number of bytes wins.
• Standard loopholes are obviously not allowed.
• Assume that the week starts with Monday (thanks to Angs and Arnauld for suggestion).
• Consider only years between 1900 and 2100 (inclusive).
• The input and output formatting rules are permissive, meaning you can use any equivalent format that is native to the language of your choice.
• Base your solution on the Gregorian calendar.
• Consider that dates are weird, you may want to specify exactly the rules, or limit the possible input to a small range (say, 1901-2099) Apr 1 '18 at 8:05
• Things to avoid when writing challenges/Adding unnecessarily stuff includes "Making answers calculate f(x) for every x in a list." What about "take an input in form of a date"? Apr 1 '18 at 8:08
• Welcome to PPCG, and nice first challenge! Although this challenge is good, in the future if you want some feedback on the challenge before posting, you can post it in the sandbox. Apr 1 '18 at 8:11
• Should the output be strictly the mentioned strings, or any 3 distinct values? Apr 1 '18 at 9:03
• (wait a minute, Gregorian calendar or Julian calendar? I suggested [1901-2099] but you decide to use [1900-2100] so they're different for some inputs) Apr 2 '18 at 16:14

JavaScript (ES6), 55 bytes

Saved 6 bytes thanks to @Neil

Takes input in currying syntax (year)(month). Returns false for asymmetric, true for centrally symmetric and 0 for completely symmetric.

y=>m=>(n=(g=_=>new Date(y,m--,7).getDay())()+g())&&n==7

Try it online!

How?

We define the function g() which returns the weekday of yyyy/mm/01, as an integer between 0 = Monday and 6 = Sunday.

g = _ => new Date(y, m--, 7).getDay()

Because getDay() natively returns 0 = Sunday to 6 = Saturday, we shift the result to the expected range by querying for the 7th day instead.

Then we define:

n = g() + g()

Because the constructor of Date expects a 0-indexed month and because g() decrements m after passing it to Date, we actually first compute the weekday of the first day of the next month and then add that of the current one.

Completely symmetric months

Completely symmetric months start with a Monday and are followed by a month which also starts with a Monday. This is only possible for February of a non-leap year.

- Feb --------------    - Mar --------------
Mo Tu We Th Fr Sa Su    Mo Tu We Th Fr Sa Su
--------------------    --------------------
01 02 03 04 05 06 07    01 02 03 04 05 06 07
08 09 10 11 12 13 14    08 09 10 11 12 13 14
15 16 17 18 19 20 21    15 16 17 18 19 20 21
22 23 24 25 26 27 28    22 23 24 25 26 27 28
29 30 31

This leads to n = 0.

Centrally symmetric months

Centrally symmetric months are months for which the sum of the weekday of their first day and that of the next month is 7.

- M ----------------    - M+1 --------------
Mo Tu We Th Fr Sa Su    Mo Tu We Th Fr Sa Su
--------------------    --------------------
0  1  3  4  5  6     0  1  2  3  4  6
--------------------    --------------------
01 02 03 04 05                   01 02
06 07 08 09 10 11 12    03 04 05 06 07 07 09
13 14 15 16 17 18 19    ...
20 21 22 23 24 25 26
27 28 29 30 31

Hence the second test: n == 7.

No built-in, 93 bytes

Uses Zeller's congruence. Same I/O format as the other version.

y=>m=>(n=(g=_=>(Y=y,((m+(m++>2||Y--&&13))*2.6|0)+Y+(Y>>2)-6*~(Y/=100)+(Y>>2))%7)()+g())&&n==7

Try it online!

• I thought it was true, false and filenotfound instead of 0
– Angs
Apr 1 '18 at 10:00
• g=m=>new Date(y,m,7).getDay() saves 6 bytes.
– Neil
Apr 1 '18 at 21:18

T-SQL, 213 bytes (strict I/O rules)

SET DATEFIRST 1SELECT CASE WHEN a+b<>8THEN'a'WHEN a=1THEN''ELSE'centrally 'END+'symetric'FROM(SELECT DATEPART(DW,f)a,DATEPART(DW,DATEADD(M,1,f)-1)b FROM (SELECT CONVERT(DATETIME,REPLACE(s,'.','')+'01')f FROM t)y)x

The above query considers the strict input/output formatting rules.

The input is taken from the column s of a table named t:

CREATE TABLE t (s CHAR(7))
INSERT INTO t VALUES ('2018.04'),('2018.03'),('2010.02'),('1996.02')

Ungolfed:

SET DATEFIRST 1
SELECT *, CASE WHEN a+b<>8 THEN 'a' WHEN a=1 AND b=7 THEN '' ELSE 'centrally ' END+'symetric'
FROM (
SELECT *,DATEPART(WEEKDAY,f) a,
FROM (SELECT *,CONVERT(DATETIME,REPLACE(s,'.','')+'01')f FROM t)y
) x

SQLFiddle 1

T-SQL, 128 bytes (permissive I/O rules)

SET DATEFIRST 1SELECT CASE WHEN a+b<>8THEN 1WHEN a=1THEN\END FROM(SELECT DATEPART(DW,d)a,DATEPART(DW,DATEADD(M,1,d)-1)b FROM t)x

If the format of the input and of the output can be changed, I would choose to input the first day of the month, in a datetime column named d:

CREATE TABLE t (d DATETIME)
INSERT INTO t VALUES ('20180401'),('20180301'),('20100201'),('19960201')

The output would be 1 for asymetric, 0 for symetric, NULL for centrally symetric.

If we can run it on a server (or with a login) configured for BRITISH language, we can remove SET DATEFIRST 1 saving 15 more bytes.

SQLFiddle 2

• Nice work. Not sure if it'll work in all versions, but on SQL 2012 I was able to save 15 bytes by using CONVERT(DATETIME,s+'.01') instead of REPLACE. You can also drop the space in FROM (SELECT Apr 3 '18 at 14:58
• It works, but it's dependant on the DATEFORMAT setting. For example, if we use SET LANGUAGE BRITISH, then CONVERT(DATETIME,'2018.02.01') would be January 2nd, instead of February 1st. Apr 3 '18 at 16:46

import Data.Time.Calendar
import Data.Time.Calendar.WeekDate
$1/1"|dc -e??sad8*la-55-rla+8-d*64*+p Input is formatted as YYYY/MM. Output is numeric, as follows: • less than 0: centrally symmetric • exactly 0: symmetric • greater than 0: asymmetric I assume this output format is acceptable for this question. Try it online! C, 111 bytes a;g(y,m){y-=a=m<3;return(y/100*21/4+y%100*5/4+(13*m+16*a+8)/5)%7;}f(y,m){a=g(y,m)+g(y,m+1);return(a>0)+(a==7);} Invoke f(year, month), 0 for completely symmetric, 1 for asymmetric, 2 for centrally symmetric. • IIRC you can abuse UB on GCC by replacing return with y= (the first parameter) and falling out of the function. Apr 3 '18 at 10:48 Perl 6, 74 bytes {{{$_==30??2!!$_%7==2}(2*.day-of-week+.days-in-month)}(Date.new("$_-01"))}

Bare block, implicitly a function of 1 argument, a string like "2012-02". Returns:

2     # Fully symmetric
True  # Centrally symmetric
False # Asymmetric

When the pattern is symmetric, as .day-of-week increases by 1, .days-in-month would need to move by 2 in order to still match (the month would be starting a day later but need to end a day earlier), so 2 * .day-of-week + .days-in-month gives us a measure of that gap. Modulo 7 it should be 1 to get symmetry, but we can first cheaply check for the non-leap February by checking that total before modulo (Monday and 28 days per month is the minimum possible combination).

I'm surprised that this takes so many bytes, but fully 36 bytes are needed for just making a date and getting the day of the week and days in that month.