從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