我的日期格式为'3/20/2019 17:23:00'
或'2/1/2019 11:44:00'
,当我在蜂巢中将类型指定为时间戳时,它们以null
的形式出现。我正在尝试使用以下代码将其转换为,但是我不确定这是不可能的还是我没有正确指定模式。
例如,这些日期变量之一称为“ on_dtml”
from_unixtime(unix_timestamp(on_dtml, 'MM/DD/YY HH:MM:SS'))
我将值以字符串格式写在一个表中,在时间戳中定义了第二个表,现在我尝试使用上述代码将表中的值作为字符串存储到第二个表中。请帮助
insert into table test_table
select variable1 string, from_unixtime(unix_timestamp(on_dtml, 'MM/DD/YY HH:MM:SS'));
答案 0 :(得分:0)
正确的格式为from flask import Flask
from twisted.internet import reactor
from twisted.web.proxy import ReverseProxyResource
from twisted.web.resource import Resource
from twisted.web.server import Site
from twisted.web.wsgi import WSGIResource
app = Flask(__name__)
@app.route('/example')
def index():
return 'Flask within Twisted?'
flask_site = WSGIResource(reactor, reactor.getThreadPool(), app)
root = Resource()
site_example = ReverseProxyResource('localhost', 4200, b'')
root.putChild(b'ssh', site_example)
reactor.listenTCP(8081, Site(root))
reactor.run()
:
'MM/dd/yyyy HH:mm:ss'
在此处了解格式模式:SimpleDateFormat在模式中大写/小写都很重要。
在此处查看测试:http://demo.gethue.com/hue/editor?editor=292420
from_unixtime(unix_timestamp(on_dtml, 'MM/dd/yyyy HH:mm:ss'));
结果:
select from_unixtime(unix_timestamp('3/20/2019 17:23:00', 'MM/dd/yyyy HH:mm:ss'));
再进行一次测试:
2019-03-20 17:23:00
结果:
select from_unixtime(unix_timestamp('2/1/2019 11:44:00', 'MM/dd/yyyy HH:mm:ss'));