openwrtv4/scripts/portable_date.sh
Felix Fietkau 64ec9dc2a1 scripts/portable_date.sh: fix parsing of date strings on non-GNU systems
Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 48592
2016-02-01 10:33:15 +00:00

11 lines
172 B
Bash
Executable file

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