简体   繁体   English

将TIMESTAMP转换为hql中的日期

[英]Convert TIMESTAMP to date in hql

I have TIMESTAMP and I want to convert it to Date format. 我有TIMESTAMP,我想将其转换为Date格式。 I have tried with to_char method but it gives me an error that the format is not compatible. 我已经尝试过to_char方法,但是它给我一个错误,指出该格式不兼容。 Plz help me with this. 请帮助我。

This is the TIMESTAMP that I want to convert, 这是我要转换的时间戳,

timestampCreated = 29-SEP-10 00.00.00.000000000

and I want it from 我想要它

"dd-MM-yyyy"

this format. 这种格式。 And I have tried with this, 我已经尝试过了

to_char(ap.timestampCreated,'dd-MM-yyyy')

But it's not working. 但这不起作用。 Plz help me. 请帮我。 Thank you. 谢谢。

timestampCreated = 29-SEP-10 00.00.00.000000000 timestampCreated = 29-SEP-10 00.00.00.000000000

new SimpleDateFormat("dd-MM-yyyy").format(timestampCreated) 新的SimpleDateFormat(“ dd-MM-yyyy”)。format(timestampCreated)

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

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