Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use date-time timestamp in oracle

2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article will explain in detail how to use date-time timestamp in oracle. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

1. Convert character type to timestamp

Select to_timestamp ('01-October-15 07.46.41.0000000am', 'dd-MON-yy hh:mi:ss.ff AM') from dual

2. Timestamp is converted to date type

Select cast (to_timestamp ('01-October-15 07.46.41.0000000am', 'dd-MON-yy hh:mi:ss.ff AM') as date) timestamp_to_date from dual

3. Date type is converted to timestamp

Select cast (sysdate as timestamp) date_to_timestamp from dual

4. Get the system time in timestamp format

Select systimestamp from dual

5. The subtraction of the dates of the two date gives the number of days, while the subtraction of the dates of the two timestamp gives the complete year, month, day, hour, minute and decimal second.

Select systimestamp-systimestamp from dual; select sysdate-sysdate from dual

Note: timestamp needs to convert it with a function to calculate the number of seconds between two days.

This is the end of this article on "how to use date-time timestamp in oracle". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report