Home » Developer & Programmer » Forms » DATE/TIME Format issue
DATE/TIME Format issue [message #250285] Mon, 09 July 2007 08:34 Go to next message
bbaz
Messages: 138
Registered: April 2007
Senior Member
HI Guys,

I have a bit confusing case that I wanted to share with you. I am trying to format my DATE/TIME before inserting into the DB, but I am NOT getting the Proper Time???

When I run the statement in Toad, I get the right result:

Select TO_date(to_char(SYSDATE,'YYYY')||'-'||'02-05 13:19'||':00','YYYY-DD-MM HH24:MI:SS') as newDATE from DUAL;


Result
5/2/2007 1:19:00 PM

The issue is here:
The have a field "ACTUAL_START_DT" of data type 'DATETIME' and Format Mask 'DD-MM hh24:mi'.
When I try to use the same conversion in my form before Updating my record I get the WRONG time (5/2/2007 7:00:00 AM) "The Date is Formatted fine but the TIME IS INCORRECT???", code below:

Update <table_name>
SET
MVT_ACT_START_DT = TO_DATE(to_char(SYSDATE,'YYYY')||'-'||:MVT_MAINTAIN.ACTUAL_START_DT||':00','YYYY-DD-MM HH24:MI:SS'),


There is no way that I am changing the Time before Inserting as I am Displaying the Field Content just after I Trigger 'WHEN-BUTTON-PRESSED'

What am I missing here?

Thanks
icon9.gif  Re: DATE/TIME Format issue [message #251531 is a reply to message #250285] Sat, 14 July 2007 03:57 Go to previous messageGo to next message
bbaz
Messages: 138
Registered: April 2007
Senior Member
Guys I know where my problem is but I still need some help.

My problem is with the FORM Text Field (DATETIME format mask: DD-MM HH24:MI) that I am using. The Field properly displays a DATE/TIME as DD-MM HH24:MI (14-07 16:23) but when I want to use the Field Value it is ONLY giving the DATE (NO TIME???) (14-Jul-07) how come the time is taken properly from the DB and displayed in the Field but the Value of the Field is Date Only.

It seems that the Time is not Recognized by the Field?

Can someone tell me what is wrong with this Field?

Thanks a million
icon14.gif  Re: DATE/TIME Format issue [message #251540 is a reply to message #251531] Sat, 14 July 2007 08:46 Go to previous message
bbaz
Messages: 138
Registered: April 2007
Senior Member
I did the following changes and now the Field is working properly:

1) Changed the Datetime Field Format mask to: DD-MM-YY HH24:MI
2) Now when I try to display the Field Content
Message('ACT start: ' ||to_char(<:blockname.fieldname>,'MM/DD/YYYY HH24:MI:SS'));

The Date is displayed Properly WITH THE TIME (so Time is not missing now)

3) when I Insert/update the corresponding Database Column, I just assign DIRECTLY with no conversion
	UPDATE <tablename>
        SET 	   		   					myDBcolumn = <:blockname.fieldname>,


HOPE THIS HELPS OTHERS WHO MIGHT FACE SUCH PROBLEMS
Previous Topic: problem while deploying form 6i in the web
Next Topic: FRM 92100
Goto Forum:
  


Current Time: Fri Sep 27 00:14:38 CDT 2024