1.获取系统当前时间

SQL Server 2005:

1 select getdate()
Oracle:
1 select sysdate from dual

2.获取年月日

SQL Server 2005:

1 select year(getdate()) --2011
2  select month(getdate()) --3
3  select day(getdate()) --23

Oracle:

1 select to_char(sysdate,'yyyy') from dual --2011
2  select to_char(sysdate,'mm') from dual --03
 3  select to_char(sysdate,'dd') from dual --23
 
q 季度
hh   小时(12)
hh24   小时(24)
mi   分
ss   秒
D   周中的星期几
ddd   年中的第几天
WW   年中的第几个星期
W   该月中第几个星期

相关文章:

  • 2021-09-03
  • 2021-12-18
  • 2022-02-18
  • 2022-12-23
  • 2021-11-02
  • 2021-05-18
  • 2021-08-08
  • 2021-08-26
猜你喜欢
  • 2022-01-01
  • 2021-09-25
  • 2021-11-17
  • 2021-10-30
  • 2021-07-31
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案