如何从datetime变量获取时间 [英] how to get time from datetime variable
本文介绍了如何从datetime变量获取时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个网站,可以接受数据并将其存储在oracle数据库中
我在oracle中有表
它的Intension_Start_date列之一是日期类型
网站接受00:00:00格式的时间,并将其存储在Intension_Start_date
列中
该列的值是1980年1月1日
我如何获得此专栏的时间
无论我何时写,该列仅显示1980年1月1日
如何检查我通过网站输入的任何时间是否输入到database
i have a website which aacepts data and stores it in oracle database
i have table in oracle
one of its column Intension_Start_date is of type date
the website acepts time in 00:00:00 format and stores it in column Intension_Start_date
the column has value 1 jan 1980
how can i get time for this column
whatever time i write the column shows only 1 jan 1980
how can i check whether whatever time i entered through website is entered in database
推荐答案
,在SQL Server中,我们始终使用Getdate(),它显示当前日期和时间.在Oracle中,我认为这应该可行.
In SQL Server we always use Getdate(), it shows the current date and time..in Oracle i guess this should work..
尝试一下:
Try this:
SELECT TO_CHAR(Col1, 'mi:ss') FROM Table1
如果您谈论的是Oracle,则可以使用EXTRACT()
函数.
这是关于它的链接:
http://www.java2s.com/Tutorial/Oracle/0260__Date- Timestamp-Functions/Catalog0260__Date-Timestamp-Functions.htm [ ^ ]
If you are talking about Oracle you may useEXTRACT()
function.
Here is a link about it:
http://www.java2s.com/Tutorial/Oracle/0260__Date-Timestamp-Functions/Catalog0260__Date-Timestamp-Functions.htm[^]
这篇关于如何从datetime变量获取时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文