输入看起来像:
2017-07-03
预期输出如下:
20170703
我尝试了以下代码:
year(2017-07-03) * 10000 + month(2017-07-03) * 100 + day(2017-07-03))
是否有可以进行此转换的内置函数?
谢谢
答案 0 :(得分:0)
您可以#!/usr/bin/env bash
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Xms8192m -Xmx8192m -
XX:UseConcMarkSweepGC"
# memory
JAVA_OPTS="$JAVA_OPTS -XX:PermSize=64m -XX:MaxPermSize=128m"
# Timezone and JVM file encoding
JAVA_OPTS="$JAVA_OPTS -Duser.timezone=UTC -Dfile.encoding=UTF8"
# solr.solr.home => solr home for this app instance
# port => app server port no.
# hostContext => wepapp context name
# zkHost => ZooKeeper ensemble host names and its client port no.
# zkClientTimeout => ZooKeeper client timeout
ZKSETUP="ZKSETUP_REPLACE"
#SOLR_OPTS="-Dsolr.solr.home=/home/ci/solr -Dport=8983 -
DhostContext=search -DzkClientTimeout=20000" # Local w/o zoo
#SOLR_OPTS="-Dsolr.solr.home=/home/ci/solr -Dport=8983 -
DhostContext=search -DzkClientTimeout=20000 -DzkHost=localhost:9983 -
DzkRun" # Local w/zoo
#SOLR_OPTS="-Dsolr.solr.home=/home/ci/solr -Dport=8983 -
DhostContext=search -DzkClientTimeout=20000 -DzkHost=sjc-dev-
usrv29.corp.coupons.com:2181,sjc-dev-usrv29.corp.coupons.com:2182,sjc-
dev-usrv29.corp.coupons.com:2183" # Cloud Zoo
SOLR_OPTS="-Dsolr.solr.home=/home/ci/solr -Dport=8983 -
DhostContext=search -DzkClientTimeout=20000 $ZKSETUP"
JAVA_OPTS="$JAVA_OPTS $SOLR_OPTS"
#JMX Config Options
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote -
Dcom.sun.management.jmxremote.port=9000 \
-Dcom.sun.management.jmxremote.ssl=false -
Dcom.sun.management.jmxremote.authenticate=false"
CATALINA_OUT="/home/ci/logs/web/tomcat7/catalina.out"
# GC, GC Logging Config Options
JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -
XX:+PrintGCDetails -XX:+PrintTenuringDistribution\
-XX:+PrintAdaptiveSizePolicy -XX:+PrintGCApplicationStoppedTime -
XX:+PrintReferenceGC -Xloggc:/home/ci/logs/web/tomcat7"
LOGGING_CONFIG="-
Djava.util.logging.config.file=/home/ci/tomcat7/logging.properties"
和from_unixtime
使用unix_timestamp
来执行此操作。
cast
答案 1 :(得分:-1)
您可以拆分' - ',然后再连接回来。或者用“”代替“ - ”。
regexp_replace("2017-07-03", "-", "")