If I give you a date, can you tell me what day that date is? For example, december 8th, 2015 is a tuesday.

Your job is to write the function ```day(d)```
which takes a string representation of a date as input, in the format YYYYMMDD. The example would be "20151208". The function needs to output the string representation of the day, so in this case ```"Tuesday"```.

Your function should be able to handle dates ranging from January first, 1582 (the year the Gregorian Calendar was introduced) to December 31st, 9999. You will not be given invalid dates. Remember to take leap years into account.

Difficulty: introductory

Starter code:

def day(date):
	

Solutions:
import datetime
import calendar

def day(date):
    return calendar.day_name[datetime.datetime.strptime(date,"%Y%m%d").weekday()]

from datetime import datetime

WEEKDAYS = ('Monday', 'Tuesday', 'Wednesday', 'Thursday',
            'Friday', 'Saturday', 'Sunday')


def day(date):
    return WEEKDAYS[datetime.strptime(date, '%Y%m%d').weekday()]


from datetime import datetime
def day(date):
    return '{:%A}'.format(datetime.strptime(date, '%Y%m%d'))

from datetime import datetime

def day(date):
    return format(datetime.strptime(date, '%Y%m%d'), '%A')

from dateutil import parser
import calendar
def day(date):
    return calendar.day_name[parser.parse(date).weekday()]


import datetime

def day(date):
    yy = int(date[0:4])
    mm = int(date[4:6])
    dd = int(date[6:8])
    return datetime.date(yy, mm, dd).strftime('%A')

import datetime
def day(date):
    return datetime.datetime.strptime(date, '%Y%m%d').strftime('%A')

from datetime import datetime
import calendar
def day(date):
    return calendar.day_name[datetime.strptime(date,"%Y%m%d").weekday()]

from calendar import day_name, monthcalendar

def day(date):
    year, month, day = list(map(int, (date[:4], date[4:6], date[6:])))
    first_day = monthcalendar(year, month)[0].index(1)
    return day_name[ (first_day+day-1) % 7 ]