I need to retrieve the month of a date (dd.month.year) and transform it into the digit YYYY-MM
the source month is in french, so i try :
# date --date="$(printf "01 %s" "January 2020")" +"%Y-%m"
2020-01
# LC_TIME=fr_FR date --date="$(printf "01 %s" "Janvier 2020")" +"%Y-%m"
date: invalid date '01 Janvier 2020'
# LANG=fr_FR date --date="$(printf "01 %s" "Janvier 2020")" +"%Y-%m"
date: invalid date '01 Janvier 2020'
it works when I use the month in English.
But with the month in French even by forcing the language or local environment parameters it does not recognize the month correctly.
even with date simply it still announces in us :
# LANG=fr_FR date
Sun May 17 23:45:40 CEST 2020
# LC_TIME=fr_FR date
Sun May 17 23:45:48 CEST 2020
# date
Sun 17 May 2020 11:45:53 PM CEST
any idea ?
info :
Operating System: Debian GNU/Linux 10 (buster)
Kernel: Linux 4.19.0-8-amd64
Architecture: x86-64