I did this using the macro file makebst.tex
, which takes you through a list of Q&A options, one of which is sort order.
I then copied over relevant chunks of code from the new .bst that macro made to the style file I actually wanted to use. The code copied:
FUNCTION {negate.year}
{ year empty$
{ "99999" }
{ year #1 #1 substring$ chr.to.int$ #105 swap$ - int.to.chr$
year #2 #1 substring$ chr.to.int$ #105 swap$ - int.to.chr$ *
year #3 #1 substring$ chr.to.int$ #105 swap$ - int.to.chr$ *
year #4 #1 substring$ chr.to.int$ #105 swap$ - int.to.chr$ *
}
if$
}
I've now added month-based sorting (which is kind of ugly because the month three-letter abbreviations need to be parsed into #'s):
FUNCTION {sort.format.month}
{ 't :=
t #1 #3 substring$ "l" change.case$ "jan" =
{ "01" }
{ t #1 #3 substring$ "l" change.case$ "feb" =
{ "02" }
{ t #1 #3 substring$ "l" change.case$ "mar" =
{ "03" }
{ t #1 #3 substring$ "l" change.case$ "apr" =
{ "04" }
{ t #1 #3 substring$ "l" change.case$ "may" =
{ "05" }
{ t #1 #3 substring$ "l" change.case$ "jun" =
{ "06" }
{ t #1 #3 substring$ "l" change.case$ "jul" =
{ "07" }
{ t #1 #3 substring$ "l" change.case$ "aug" =
{ "08" }
{ t #1 #3 substring$ "l" change.case$ "sep" =
{ "09" }
{ t #1 #3 substring$ "l" change.case$ "oct" =
{ "10" }
{ t #1 #3 substring$ "l" change.case$ "nov" =
{ "11" }
{ t #1 #3 substring$ "l" change.case$ "dec" =
{ "12" }
{ "00" } % No match
if$
}
if$
}
if$
}
if$
}
if$
}
if$
}
if$
}
if$
}
if$
}
if$
}
if$
}
if$
}
FUNCTION {negate.month}
{ month empty$
{ "999" }
{
month sort.format.month #1 #1 substring$ chr.to.int$ #105 swap$ - int.to.chr$
month sort.format.month #2 #1 substring$ chr.to.int$ #105 swap$ - int.to.chr$ *
}
if$
}
and bib.sort.order
was replaced with:
FUNCTION {bib.sort.order}
{ sort.label
" "
*
negate.month field.or.null sortify
swap$
*
negate.year field.or.null sortify
swap$
*
" "
*
title field.or.null
sort.format.title
*
#1 entry.max$ substring$
'sort.key$ :=
}
EDIT: Now sorts by year-then-month. I actually understand what all the code does now, too, which is an improvement.