dolphindb中如何把指定格式应用到给定对象,例如把2018.01.02输出为01/02/2018

dolphindb中如何把指定格式应用到给定对象,例如把2018.01.02输出为01/02/2018,把70.832104输出为70.83,把1719输出为1,719?

请先 登录 后评论

1 个回答

Jason Tang - 时序数据库技术支持

可以通过dolphindb中的format(X, format)函数把指定格式应用到给定对象。
例如创建一个这样的表:

t = table(1..100 as id, (1..100 + 2018.01.01) as date, rand(100.0100) as price, rand(10000100) as qty)

可以通过format对输出的内容进行格式转换:

select id, date.format("MM/dd/yyyy") as date, price.format("00.00") as price, qty.format("#,###") as qty from t
请先 登录 后评论