简体   繁体   English

如何用 mongodb 和 cubejs 格式化时间类型的数据?

[英]How to format time-type data with mongodb and cubejs?

I found this url about this topic:我发现这个 url 关于这个话题:

I didnt found the format for time-type.我没有找到时间类型的格式。 So I try to use sql: PARSE_TIMESTAMP('%Y-%m-%d', date)所以我尝试使用 sql: PARSE_TIMESTAMP('%Y-%m-%d', date)

    createdat: {
      sql: `PARSE_TIMESTAMP('%Y-%m-%d',${CUBE}.\`createdAt\`)`,
      type: `time`
    },

it will return a error:它会返回一个错误:

Error: Error: scalar function 'parse_timestamp' is not supported
createdat: {
    sql: `DATE(${CUBE}.\`createdAt\`, '%Y-%m-%d')`,
    type: `time`
},

Thanks谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM