var get_end_time = "select CURRENT_TIME()";
var time_sql = {sqlText: get_end_time};
var time_create = snowflake.createStatement(time_sql);
var time_exec_end = time_create.execute();
time_exec_end.next();
var end_time = time_exec_end.getColumnValue(1);
我在snowflake的JavaScript存储过程中有上面的代码,这个查询产生:11:27:35.181000000
我怎么能把这个去掉,只给我11:27:35?
JavaScript过程返回类型为字符串,所以价值在雪花中不能被解释为时间或应用时基格式。
没有时间格式的代码-
CREATE OR REPLACE PROCEDURE test_time()
RETURNS STRING
LANGUAGE javascript
AS
$$
var get_end_time = "select CURRENT_TIME()";
var time_sql = {sqlText: get_end_time};
var time_create = snowflake.createStatement(time_sql);
var time_exec_end = time_create.execute();
time_exec_end.next();
var end_time = time_exec_end.getColumnValue(1);
return end_time;
$$
;
call test_time();
TEST_TIME | 06:20:47.250000000 |
---|