Bash, 113 bytes
s="1ドル-1";e="2ドル-1";sort <(while [ "$s" \< "$e" ];do s=$(date +%F -d"$s+1month");date +%d -d"$s-1day";done)|uniq -c
needs golfing...
takes input as 2016-03 2018-10
outputs:
1 28
7 30
12 31
ungolfed:
s="1ドル-1"
e="2ドル-1" # adds first day of month to the dates
sort <(
while [ "$s" \< "$e" ]; do #iterates over datedates
s=$(date +%F -d"$s+1month") #adds one month to destart date
date +%d -d"$s-1day" #outputs last day of previous month
done) | uniq -c #counts ocurrences of day number prevously sorted
appends first day of month to the input, adds one moth and outputs one day less looping over
Bash, 113 bytes
s="1ドル-1";e="2ドル-1";sort <(while [ "$s" \< "$e" ];do s=$(date +%F -d"$s+1month");date +%d -d"$s-1day";done)|uniq -c
needs golfing...
takes input as 2016-03 2018-10
outputs:
1 28
7 30
12 31
ungolfed:
s="1ドル-1"
e="2ドル-1" # adds first day of month to the dates
sort <(
while [ "$s" \< "$e" ]; do #iterates over date
s=$(date +%F -d"$s+1month") #adds one month to de date
date +%d -d"$s-1day" #outputs last day of previous month
done) | uniq -c #counts ocurrences of day number prevously sorted
appends first day of month to the input, adds one moth and outputs one day less looping over
Bash, 113 bytes
s="1ドル-1";e="2ドル-1";sort <(while [ "$s" \< "$e" ];do s=$(date +%F -d"$s+1month");date +%d -d"$s-1day";done)|uniq -c
needs golfing...
takes input as 2016-03 2018-10
outputs:
1 28
7 30
12 31
ungolfed:
s="1ドル-1"
e="2ドル-1" # adds first day of month to the dates
sort <(
while [ "$s" \< "$e" ]; do #iterates over dates
s=$(date +%F -d"$s+1month") #adds one month to start date
date +%d -d"$s-1day" #outputs last day of previous month
done) | uniq -c #counts ocurrences of day number prevously sorted
Bash, 113 bytes
s="1ドル-1";e="2ドル-1";sort <(while [ "$s" \< "$e" ];do s=$(date +%F -d"$s+1month");date +%d -d"$s-1day";done)|uniq -c
needs golfing...
takes input as 2016-03 2018-10
outputs:
1 28
7 30
12 31
ungolfed:
s="1ドル-1"
e="2ドル-1" # adds first day of month to the dates
sort <(
while [ "$s" \< "$e" ]; do #iterates over date
s=$(date +%F -d"$s+1month") #adds one month to de date
date +%d -d"$s-1day" #outputs last day of previous month
done) | uniq -c #counts ocurrences of day number prevously sorted
appends first day of month to the input, adds one moth and outputs one day less looping over