ajouter de nouveaux formats pour parse_date
This commit is contained in:
parent
1151b5c01a
commit
e6be47eb32
|
@ -393,7 +393,9 @@ function parse_date() {
|
|||
local value="$1" type="${2:-date}"
|
||||
local now="$(awk 'BEGIN { print mktime(strftime("%Y %m %d 00 00 00 +0400")) }')"
|
||||
case "$value" in
|
||||
=*) value="${value#=}";;
|
||||
+*) value="$(($now + ${value#+} * 86400))";;
|
||||
-*) value="$(($now - ${value#-} * 86400))";;
|
||||
*) value="$(<<<"$value" awk -F/ '{
|
||||
nd = strftime("%d"); nm = strftime("%m"); ny = strftime("%Y")
|
||||
d = $1 + 0; if (d < 1) d = nd;
|
||||
|
@ -407,6 +409,7 @@ function parse_date() {
|
|||
d|date) awk '{ print strftime("%d/%m/%Y", $0 + 0) }' <<<"$value";;
|
||||
l|ldap) awk '{ print strftime("%Y%m%d%H%M%S+0400", $0 + 0) }' <<<"$value";;
|
||||
m|mysql) awk '{ print strftime("%Y-%m-%d", $0 + 0) }' <<<"$value";;
|
||||
t|ts|timestamp) echo "$value";;
|
||||
*) recho "$value";;
|
||||
esac
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue