今天勇哥去面试,完后给璞玉(POOY)打电话问获取数据库当前时间怎么写?

璞玉(POOY)测试了一下,如下:

数据库获取当前时间

=======在MySql数据库 中用如下语句:

select current_date;   获取当前 日期

 

select current_time;    获取当前 时间

 

select current_timestamp;  获取时间戳 就是日期时间

 

=======在SqlServer数据库 中用如下语句:

[ccei]select getdate()[/ccei]

=======在Oracle数据库 中用如下语句:

Oracle自带的获取当前机器的系统时间的函数:

[ccei]Select To_Char (SYSDATE,’MM-DD-YYYY HH24:MI:SS’) “now” from dual; [/ccei]

Leave a Reply

电子邮件地址不会被公开。 必填项已用*标注

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="">

请选择吧!