[英]How to specify date format for date data type in oracle apex form
I want to specify a specific format for a date column in Oracle Apex 19.2 form to limit the user to input the data in a specific format.我想在 Oracle Apex 19.2 表单中为日期列指定特定格式,以限制用户以特定格式输入数据。 For example, I want this query for a form to be valid:
例如,我希望表单的此查询有效:
Select phone_no, call_date, to_char(call_time, 'HH12:MI:SS AM')
FROM called_no;
Note: call_date
and call_time
has the same data type which is date
.注意:
call_date
和call_time
具有相同的数据类型,即date
。 I only have the problem with call_time
column.我只有
call_time
列的问题。
Well, format mask for call_time
item would be as you said: hh12:mi:ss am
.好吧,
call_time
项目的格式掩码将如您所说: hh12:mi:ss am
。
If you didn't already do that, do it.如果你还没有这样做,那就去做吧。 If you did, what problems did you have?
如果你这样做了,你有什么问题?
However, from my point of view, you're doing it wrong - you should use only one column: call_date
whose datatype is date
and use it in Apex "as is".但是,从我的角度来看,您做错了 - 您应该只使用一列:
call_date
,其数据类型为date
,并在 Apex 中“按原样”使用它。 It (the item) would accept full date AND time in desired format, eg dd.mm.yyyy hh12:mi:ss am
.它(项目)将接受所需格式的完整日期和时间,例如
dd.mm.yyyy hh12:mi:ss am
。
Because, if you use two columns/items, you'll hit a problem that call_time
column's date component will be wrong .因为,如果您使用两个列/项目,您会遇到
call_time
列的日期组件错误的问题。 Have a look:看一看:
SQL> alter session set nls_date_Format = 'dd.mm.yyyy hh12:mi:ss am';
Session altered.
SQL> select sysdate,
2 to_date('05:33:12', 'hh12:mi:ss pm') right_now
3 from dual;
SYSDATE RIGHT_NOW
---------------------- ----------------------
22.12.2021 05:34:19 PM 01.12.2021 05:33:12 AM
----- -----
today see this? Date component is truncated to 1st of current month
Illustration:插图:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.