从星期天开始起算

   Function Fn_GetWeekbyDate(P_Date Varchar2) Return Varchar2
Is
Begin
Return To_char(To_Date(P_Date,'yyyy-mm-dd'),'fmww');
End Fn_GetWeekbyDate;

从星期一开始起算

   Function Fn_GetWeekbyDate(P_Date Varchar2) Return Varchar2
Is
Begin
Return To_char(To_Date(P_Date,'yyyy-mm-dd'),'fmiw');
End Fn_GetWeekbyDate;

下面是一个有效参数列表to_char函数是用来转换为一个字符串的日期。这些参数可用于在多种组合。

Parameter Explanation
YEAR Year, spelled out
YYYY 4-digit year
YYY
YY
Y
Last 3, 2, or 1 digit(s) of year.
IYY
IY
I
Last 3, 2, or 1 digit(s) of ISO year.
IYYY 4-digit year based on the ISO standard
Q Quarter of year (1, 2, 3, 4; JAN-MAR = 1).
MM Month (01-12; JAN = 01).
MON Abbreviated name of month.
MONTH Name of month, padded with blanks to length of 9 characters.
RM Roman numeral month (I-XII; JAN = I).
WW Week of year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year.
W Week of month (1-5) where week 1 starts on the first day of the month and ends on the seventh.
IW Week of year (1-52 or 1-53) based on the ISO standard.
D Day of week (1-7).
DAY Name of day.
DD Day of month (1-31).
DDD Day of year (1-366).
DY Abbreviated name of day.
J Julian day; the number of days since January 1, 4712 BC.
HH Hour of day (1-12).
HH12 Hour of day (1-12).
HH24 Hour of day (0-23).
MI Minute (0-59).
SS Second (0-59).
SSSSS Seconds past midnight (0-86399).
FF Fractional seconds.

最新文章

  1. 【转载】 Python动态生成变量
  2. C# params object[] args 可以传多个参数,可以不限制类型(转)
  3. html 实体转换为字符:转换 UEditor 编辑器 ( 在 ThinkPHP 3.2.2 中 ) 保存的数据
  4. 正则表达式30分钟入门教程<转载>
  5. php用正则表达式获取网站的标题内容
  6. Char型和string型字符串比较整理
  7. 机器人操作系统 除了Android还有一个ROS(转)
  8. js-异步机制与同步机制
  9. python-opencv aplpha混合
  10. 云计算之路-阿里云上-2017年最错误的选择: 生产环境使用 docker swarm
  11. c/c++ 贪吃蛇控制台版
  12. 修改mysqlcharacter_set_database与character_set_server的默认编码(windows环境)
  13. 使用Genymotion遇到的坑_Genymotion无法启动_unable to start the virtual device
  14. C#Razor模板引擎简单使用
  15. Java Native
  16. HTTP协议02-请求和响应的报文构成
  17. vue学习笔记1-基本知识
  18. 大牛blog
  19. hdu 1203 dp(关于概率的```背包?)
  20. 来回最短路POJ3268

热门文章

  1. 关于Android中传递数据的一些讨论--备用
  2. 最近Get到的一些HTML/CSS中的小点(一)
  3. PANGU---Planet and Asteroid Natural scene Generation Utility
  4. Two-phase Termination模式
  5. Qt4.8 移植(超详细Configure的参数)
  6. Oracle imp 不同字符集导入
  7. HDOJ 1312题Red and Black
  8. 在Xcode中使用Clang Format
  9. 【索引】Objective-C基础教程-读书笔记
  10. IOS引用的静态库里包含category文件出现“unrecognized selector”的解决办法