portable_date.sh 171 B

1234567891011
  1. #!/bin/sh
  2. case $(uname) in
  3. NetBSD|OpenBSD|DragonFly|FreeBSD|Darwin)
  4. date -j -f "%Y-%m-%d %H:%M:%S %z" "$1" "$2" 2>/dev/null
  5. ;;
  6. *)
  7. date -d "$1" "$2"
  8. esac
  9. exit $?