cdate

#!/usr/bin/env rc
# converts current locale weekday or month to C locale
fn _convert {
  switch($2) {
    case %A
      strings_c=(Monday Tuesday Wednesday Thursday Friday Saturday Sunday)
    case %a
      strings_c=(Mon Tue Wed Thu Fri Sat Sun)
    case %B
      prefix='1 '; strings_c=(January February March April May June July August September October November December)
    case %b
      prefix='1 '; strings_c=(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
  }
  for (string_c in $strings_c) {
    string_locale=`{date +$2 -d$prefix$string_c}
    if (~ $1 $string_locale) { echo $string_c; exit 0 }
  }
}

for (i in (%A %a %B %b)) { _convert $1 $i }; exit 1