日期/时间功能
Date/ time function
我有一个包含四 (4) 列的“phone 付款”表单
- Phone_Number
- user_name
- invoice_date
- invoice_amount
- exceeding_amount
我想要完成的是在为每个用户输入新记录时将 invoice_date 设置为新月的 24 日。
例如-
January records should show
Phone_number User_name invoice_date invoice_amount
123456 test 24/1/2021 100
678901 testing 24/1/2012 200
和
February records should show
Phone_number User_name invoice_date invoice_amount
123456 test 24/2/2021 200
678901 testing 24/2/2012 300
其余月份依此类推
您问题中的“现在”是 Oracle 中的 sysdate
。
要获取当月的第 24 天,您可以这样做:
trunc(sysdate, 'month') + 23
(注意:+ 23
因为截断日期已经是该月的 1 日)。
你将如何使用它取决于整体情况(你用它做什么),你没有包括在你的问题中。
我有一个包含四 (4) 列的“phone 付款”表单
- Phone_Number
- user_name
- invoice_date
- invoice_amount
- exceeding_amount
我想要完成的是在为每个用户输入新记录时将 invoice_date 设置为新月的 24 日。
例如-
January records should show
Phone_number User_name invoice_date invoice_amount
123456 test 24/1/2021 100
678901 testing 24/1/2012 200
和
February records should show
Phone_number User_name invoice_date invoice_amount
123456 test 24/2/2021 200
678901 testing 24/2/2012 300
其余月份依此类推
您问题中的“现在”是 Oracle 中的 sysdate
。
要获取当月的第 24 天,您可以这样做:
trunc(sysdate, 'month') + 23
(注意:+ 23
因为截断日期已经是该月的 1 日)。
你将如何使用它取决于整体情况(你用它做什么),你没有包括在你的问题中。