date display in forms and oracle [message #343835] |
Thu, 28 August 2008 05:51 |
varu123
Messages: 754 Registered: October 2007
|
Senior Member |
|
|
Through forms I am enetering date in the database. The data type of DAte textitem is date.
In the database,after issuing alter session set nls_date_format command,
when i am querying date,it is displaying as
28-AUG-08 00:00:00
Why it is not recording the minute and seconds also?
I expected the output as
28-AUG-08 03:15:07
I changed the datatype from date to datetime but same result.
|
|
|
Re: date display in forms and oracle [message #343981 is a reply to message #343835] |
Thu, 28 August 2008 09:25 |
|
saadatahmad
Messages: 452 Registered: March 2005 Location: Germany/Paderborn
|
Senior Member |
|
|
hi,
Use a timer.
I'm attaching a form for your and other people's reference.
Run the following script.
create table test
(a date)
/
Download the attached form. Run the form and enter a date and save. It'll save date with time in database and then you can query your table.
SCOTT @ORCL> select * from test
2 /
A
-------------------
28/08/2008 05:18:19
I hope you'll be able to apply this in your form.
regards,
Saadat Ahmad
[Updated on: Thu, 28 August 2008 09:27] Report message to a moderator
|
|
|
|
Re: date display in forms and oracle [message #344261 is a reply to message #344084] |
Fri, 29 August 2008 04:32 |
|
saadatahmad
Messages: 452 Registered: March 2005 Location: Germany/Paderborn
|
Senior Member |
|
|
hi,
there may be many ways aroud if you don't want to create an item on your form. One is to define a global variable and use it to populate the time part.
Your code on When-New-Form-Instance trigger will be
:global.g_sys_time := null;
declare
my_timer timer;
begin
--Create a timer to trigger it every 1 sec(1000msec)
my_timer := create_timer('timer_sysdate',1000,repeat);
end;
When-Timer-Expired trigger code
:global.g_sys_time := to_char(sysdate,'hh:mi:ss');
When-Validate-Item code on your date item
declare
v_date_time varchar2(30);
begin
select to_char(nvl(:test.a, sysdate), 'dd/mm/rrrr')||' '||:global.g_sys_time
into v_date_time
from dual;
select to_date(v_date_time, 'dd/mm/rrrr hh:mi:ss')
into :test.a
from dual;
end;
There are other ways around. You just have to think it.
Note :
If you are using system date in your forms date item then you need to set the initial property of the item only.
Set initial property to : $$datetime$$
In this case you don't need to write the triggers.
regards,
Saadat Ahmad
[Updated on: Fri, 29 August 2008 04:34] Report message to a moderator
|
|
|
|
|
|
|