从detates
试图从Varchar2类型的日期列中提取周数时出现的问题。为了解决此问题,必须首先使用TO_DATE函数将日期转换为真实日期数据类型。但是,仅此转换可能不会产生所需的结果。要获得周号,必须使用所需的掩码将日期转换回Varchar2。 This can be achieved using the following syntax:
to_char(to_date('date_string', 'format'), 'WW')Where 'date_string' is the input date in varchar2 format, 'format' is the original date format, and 'WW' indicates the week number of the year.If you prefer the week数字作为数字数据类型,您可以将语句包装在to_number()中:to_char(to_date('date_string', 'format'), 'WW')
Parameter
Explanation
to_char(to_date('date_string', 'format'), 'WW')
标准[&& && && && && &&&&&&&&&&& && && && && && &&&华[&& && &&华 |
---|
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3