Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
279 views
in Technique[技术] by (71.8m points)

mysql - How to extract hour from timestamp?

I have taken only the time value from systimestamp. But with the same i need to extract hour from time value.

SELECT EXTRACT (HOUR FROM TO_CHAR(systimestamp,'hh24:mi:ss'')) FROM DUAL ;

but I'm getting "invalid extract field for extract source"

question from:https://stackoverflow.com/questions/66050753/how-to-extract-hour-from-timestamp

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can also use to_char as follows:

SELECT to_char(systimestamp,'hh24') FROM DUAL

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...