zoukankan      html  css  js  c++  java
  • oracle--trunc与to_char的区别

    trunc取得是天(可比较),而to_char取得是数值(可计算):
    但trunc(date) 具有与to_char(date) 相似的功能,但有区别:
     
    trunc(sysdate,'cc')   取当世纪的第一天     to_char(sysdate,'cc')   取当世纪数值
    trunc(sysdate,'yyyy') 取当年的第一天       to_char(sysdate,'yyyy') 取当年数值
    trunc(sysdate,'iyyy') 取上年的最后一天     to_char(sysdate,'iyyy') 取当年数值
    trunc(sysdate,'q')    取当季第一天         to_char(sysdate,'iyyy') 取当季数值
    trunc(sysdate,'mm')   取当月第一天         to_char(sysdate,'mm')   取当月数值
    trunc(sysdate,'ww')   取当周第一天(周二)   to_char(sysdate,'ww')   取当周数值(第几周)
    trunc(sysdate,'iw')   取当周第一天(周一)   to_char(sysdate,'iw')   取当周数值(第几周)
  • 相关阅读:
    面向对象编程
    json 和 pickle
    装饰器详解
    内置函数
    Python之基础知识
    Python之路---day2
    用户登录
    Python之路---day1
    js格式化数字和金额
    作用域链–JS基础核心之一
  • 原文地址:https://www.cnblogs.com/cyfighting/p/6108806.html
Copyright © 2011-2022 走看看