0

input: $ date -d '13 JAN 1995' +%A
output:

usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... 
            [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]

expected output: Friday .

First I thought this is because of my older version of bash 3.x but later I upgraded to 5.0. Still having this problem.

I read here for date formats Convert date formats in bash

Siraj Alam
  • 9,217
  • 9
  • 53
  • 65

1 Answers1

1

This should do the trick

date -j -f '%d %b %Y' '+%A' '13 JAN 1995'

MacOS comes with BSD date, but your command is designed to work with GNU date.
Take a look at BSD strftime(3) before fiddling with the format.

oguz ismail
  • 1
  • 16
  • 47
  • 69